diff --git a/files/.xmonad/lib/Config.hs b/files/.xmonad/lib/Config.hs index 76f3a17..39a7cd3 100644 --- a/files/.xmonad/lib/Config.hs +++ b/files/.xmonad/lib/Config.hs @@ -365,7 +365,8 @@ myKeys = concat [ zoomRowBindings, tabbedBindings, multiMonitorBindings, program , ("M-b", safeSpawnProg "google-chrome-stable") , ("M-S-", spawn myTerminal) --, ("M-S-", launchWithBackgroundInstance (className =? "Alacritty") "alacritty") - , ("M-S-<", spawn "flameshot gui") + , ("M-S-<", spawn "flameshot gui") + , ("M-z", spawn $ scriptFile "copy-pasta.sh") , ("M-S-h", fuckshit) diff --git a/files/scripts/copy-pasta.sh b/files/scripts/copy-pasta.sh index 0ab1fad..33084ec 100755 --- a/files/scripts/copy-pasta.sh +++ b/files/scripts/copy-pasta.sh @@ -1,11 +1,16 @@ #!/bin/sh -GEN_SCRIPT_DATA_PATH="/home/leon/gen-script-data" +set -e + +GEN_SCRIPT_DATA_PATH="/home/leon/copy-pasta" -options=$(for x in $GEN_SCRIPT_DATA_PATH/*; do echo "$x" | sed "s|$GEN_SCRIPT_DATA_PATH/||g"; done) +#options=$(for x in $GEN_SCRIPT_DATA_PATH/*; do echo "$x" | sed "s|$GEN_SCRIPT_DATA_PATH/||g"; done) +options=$(find "$GEN_SCRIPT_DATA_PATH" -type f | grep --invert-match ".git" | sed "s|$GEN_SCRIPT_DATA_PATH/||g") +choice="$(echo "$options" | rofi -dmenu -matching glob)" +file="$GEN_SCRIPT_DATA_PATH/$choice" +mime_type="$(file --mime-type "$choice" | sed 's/.*:\s*//g')" -echo "$options" | rofi -dmenu - +xclip -selection clipboard -in -t "$mime_type" -i "$file"