dotfiles/.local/bin/tools/dmenuhandler
Alexander Bocken 11c023aade Xresources for sxiv, various small changes
modified:   .config/Xresources
	modified:   .config/coc/history.json
	modified:   .config/qutebrowser/bookmarks/urls
	modified:   .config/qutebrowser/qsettings/QtProject.conf
	modified:   .config/qutebrowser/quickmarks
	modified:   .config/ranger/rifle.conf
	modified:   .local/bin/dropdowncalc
	deleted:    .local/bin/i3cmds/hover
	deleted:    .local/bin/i3cmds/i3resize
	deleted:    .local/bin/i3cmds/killrecording
	deleted:    .local/bin/i3cmds/maimpick
	deleted:    .local/bin/i3cmds/prompt
	deleted:    .local/bin/i3cmds/samedir
	deleted:    .local/bin/i3cmds/td-toggle
	deleted:    .local/bin/i3cmds/tmuxdd
	deleted:    .local/bin/i3cmds/toggle-welcome
	deleted:    .local/bin/i3cmds/toggletouchpad
	deleted:    .local/bin/i3cmds/torwrap
	deleted:    .local/bin/i3cmds/winresize
	modified:   .local/bin/maimpick
	modified:   .local/bin/statusbar/torrent
	modified:   .local/bin/tools/dmenuhandler
2020-08-17 13:33:09 +02:00

22 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Feed this script a link and it will give dmenu
# some choice programs to use to open it.
case "$(printf "mpv\\ncopy url\\nqueue download\\nqueue youtube-dl\\nbrowser\\nrip media\\ncast" | dmenu -i -p "Open link with what program?")" in
"copy url") echo "$1" | xclip -selection clipboard ;;
mpv) setsid mpv --quiet --ytdl-format='bestvideo[height<=1080]+bestaudio/best[height<=1080]' "$1" & ;;
"mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;;
"queue download") name="$( dmenuinput 'Name for file:' )"
tsp curl -L -o $name "$1" >/dev/null 2>&1 ;;
"queue youtube-dl") youtube-dl --write-metadata -i -o '/home/alex/%(upload_date)s-%(title)s.%(ext)s' "$1" >/dev/null 2>&1 ;;
cast) setsid $TERMINAL -e mkchromecast -y $1 --video --control
;;
browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;;
#feh) setsid feh "$1" >/dev/null 2>&1 & ;;
#w3m) w3m "$1" >/dev/null 2>&1 ;;
#"mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
"rip media") dest="$(dmenuinput 'name of folder:')"
lynx --dump --nonumbers --listonly "$1" | grep -E "(*\.webm|*\.mp4|\.gif|\.jpg|\.jpeg|\.png|\.pdf|\.epub|\.mobi|\.djvu)" | sort -u | xargs wget -P "$HOME/$dest"
notify-send "dmenuhandler" "all media ripped into $dest";;
esac