[cliplumber] Add fav feature

This commit is contained in:
lara 2021-11-13 02:41:06 +01:00
parent 703a0c29c8
commit a93fa19d62

View file

@ -22,7 +22,7 @@ fi
urls="$(echo $clip | grep -o 'https\?://[a-zA-Z0-9~#%&_+=,.?/-]\+')"
# Check the requirements for every option
opts="rot13"
opts="fav|rot13"
check_exists "$TERM_EMU" "mpv" "youtube-dl" &&
opts="audio-search|$opts"
check_exists "dragon" &&
@ -65,7 +65,7 @@ case "$choice" in
printf "%s" "$out" | sed -ne '/^NOVEL: /s/NOVEL: \(.*\)/Successfully crawled "\1"/p' | xargs -0 -n1 notify-send
fi
;;
"drag-n-drop"*)
"drag-n-drop")
dragon -x "$clip"
;;
"play")
@ -84,6 +84,14 @@ case "$choice" in
wl-copy -n "$(wl-paste | tr 'A-Za-z' 'N-ZA-Mn-za-m')"
fi
;;
# Optional argument to set a description for the fav
"f"*)
desc="$(printf "%s" "$choice" | cut -d " " -s -f 2-)"
if [ -n "$desc" ]; then
printf "# %s\n" "$desc" >> "$HOME/favs"
fi
printf "%s\n" "$urls" >> "$HOME/favs"
;;
*)
printf 'Nope\n'
;;