add copy pasta

This commit is contained in:
elkowar 2021-04-23 10:38:06 +02:00
parent 40de0424e7
commit d8ab47d23a
2 changed files with 11 additions and 5 deletions

View file

@ -365,7 +365,8 @@ myKeys = concat [ zoomRowBindings, tabbedBindings, multiMonitorBindings, program
, ("M-b", safeSpawnProg "google-chrome-stable")
, ("M-S-<Return>", spawn myTerminal)
--, ("M-S-<Return>", 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)

View file

@ -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"