Skip to content

Instantly share code, notes, and snippets.

@Bugswriter
Created March 23, 2021 00:39
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Bugswriter/65ffa6d179e9a93e043ef214cabe1ba0 to your computer and use it in GitHub Desktop.
Save Bugswriter/65ffa6d179e9a93e043ef214cabe1ba0 to your computer and use it in GitHub Desktop.
Clipboard magic is a script which run bunch of clipboard related operation
#!/bin/sh
menu(){
printf "1. [URL] Expecto Shorten πŸͺ„: Get a shorten url\n"
printf "2. [URL] Lumbos dl πŸͺ„: Download file in ~/dl\n"
printf "3. [URL] Avada Playdavra πŸͺ„: Play videos in mpv\n"
printf "4. [URL] Listenmora πŸͺ„: Play audio in mpv\n"
printf "5. [Image] Imagum Savum πŸͺ„: Save clipbaord image in ~/pix/save\n"
printf "6. [Text] Sendkulus πŸͺ„: Send clipboard text with tgsend script\n"
printf "7. [Shell] Executa πŸͺ„: This will run any shell command\n"
printf "8. [Text] Sayee it πŸͺ„: Clipboard text to speech with espeak\n"
printf "9. [Magnet] Torriento πŸͺ„: Start downloading torrent from magnet\n"
}
spell_failed(){
notify-send "Failed to cast spell"
}
choice=$(menu | dmenu -p "Clipboard spells πŸͺ„πŸ“‹:" -i -l 20 | cut -d. -f1)
cbtext=$(xclip -o -selection clipboard)
paplay $HOME/.local/share/sounds/magic.ogg &
case $choice in
1)
output=$(curl -s -F"shorten=$cbtext" 0x0.st)
if [ "$output" = "Segmentation Fault" ]; then
spell_failed
else
echo "$output" | xclip -selection c
notify-send "Shorten Link is in Clipboard"
fi
break
;;
2)
wget -P ~/dl $cbtext &&
notify-send "Downloading File" ||
spell_failed
break
;;
3)
mpv "$cbtext" || spell_failed
break
;;
4)
mpv "$cbtext" || spell_failed
break
;;
5)
file=$(date +"%Y_%m_%d_%I_%M_%p")
xclip -selection clipboard -t image/png -o > $HOME/pix/save/$file.png ||
spell_failed
break
;;
6)
user=$(echo "" | dmenu -p "Enter Username: ")
tgsend $user "$cbtext"
break
;;
7)
$cbtext || spell_failed
break
;;
8)
echo "$cbtext" | espeak -p 120
break
;;
9)
notify-send "Haven't implemented this feature yet"
break
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment