Add clipboard plumber: QR, download, play, search audio
This commit is contained in:
parent
83bc804ee0
commit
211d6d58a6
1 changed files with 31 additions and 0 deletions
31
cliplumber
Executable file
31
cliplumber
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
clip="$(xsel -b -o)"
|
||||
urls="$(echo $clip | grep -o 'https\?://[a-zA-Z0-9~#%&_+=,.?/-]\+')"
|
||||
opts="qr
|
||||
audio search"
|
||||
if [ -n "$urls" ]; then
|
||||
opts="$(printf '%s\ndownload\nplay' "$opts")"
|
||||
fi
|
||||
|
||||
#if [ -z "$urls" ]; then
|
||||
#echo "Nope : $clip"
|
||||
choice="$(printf "%s" "$opts" | dmenu -p "$(printf "%s" "$clip" | cut -c 1-48)")"
|
||||
case "$choice" in
|
||||
"qr")
|
||||
printf "%s" "$clip" | qrencode -o - | feh -. -Z --geometry 400x400 -
|
||||
;;
|
||||
"download")
|
||||
cd ~/mus || exit
|
||||
youtube-dl -x --audio-format mp3 --no-playlist -o "%(title)s.%(ext)s" "$clip"
|
||||
;;
|
||||
"play")
|
||||
mpv --ytdl-format='bestvideo[height<=?1080]+bestaudio/best' "$clip"
|
||||
;;
|
||||
"audio search")
|
||||
st -e mpv --ytdl-format=bestaudio ytdl://ytsearch:"$clip"
|
||||
;;
|
||||
*)
|
||||
printf "Nope\n"
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue