hyprdots

my dotfiles
git clone https://git.awy.one/hyprdots.git
Log | Files | Refs | README | LICENSE

dmenuhandler (1580B)


      1 #!/bin/sh
      2 
      3 # Feed this script a link and it will give wmenu
      4 # some choice programs to use to open it.
      5 feed="${1:-$(true | wmenu -p 'Paste URL or file path')}"
      6 
      7 case "$(printf "copy url\\nnsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | wmenu -i -p "Open it with?")" in
      8 	"copy url") echo "$feed" | xclip -selection clipboard ;;
      9 	mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
     10 	"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
     11 	"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30%  --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
     12 	"queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
     13 	"queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;;
     14 	"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
     15 	PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")"  >/dev/null 2>&1 ;;
     16 	nsxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")"  >/dev/null 2>&1 ;;
     17 	vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")"  >/dev/null 2>&1 ;;
     18 	setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
     19 	browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
     20 	lynx) lynx "$feed" >/dev/null 2>&1 ;;
     21 esac