dots-of-war/files/scripts/copy-pasta.sh

17 lines
509 B
Bash
Raw Normal View History

2021-04-23 08:18:51 +00:00
#!/bin/sh
2021-04-23 08:38:06 +00:00
set -e
2021-04-23 08:18:51 +00:00
2021-04-23 08:38:06 +00:00
GEN_SCRIPT_DATA_PATH="/home/leon/copy-pasta"
2021-04-23 08:18:51 +00:00
2021-04-23 08:38:06 +00:00
#options=$(for x in $GEN_SCRIPT_DATA_PATH/*; do echo "$x" | sed "s|$GEN_SCRIPT_DATA_PATH/||g"; done)
2021-04-23 09:33:43 +00:00
options=$(find "$GEN_SCRIPT_DATA_PATH" -type f | grep --invert-match ".git\|meme-maker" | sed "s|$GEN_SCRIPT_DATA_PATH/||g")
2021-04-23 08:38:06 +00:00
choice="$(echo "$options" | rofi -dmenu -matching glob)"
file="$GEN_SCRIPT_DATA_PATH/$choice"
2021-04-23 08:18:51 +00:00
2021-04-23 08:38:06 +00:00
mime_type="$(file --mime-type "$choice" | sed 's/.*:\s*//g')"
2021-04-23 08:18:51 +00:00
2021-04-23 08:38:06 +00:00
xclip -selection clipboard -in -t "$mime_type" -i "$file"