dmenuhandler script fixes and tweaks
This commit is contained in:
parent
1220d6a101
commit
f39d0f3391
1 changed files with 9 additions and 17 deletions
|
@ -1,22 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# Feed this script a link and it will give dmenu
|
# Feed this script a link and it will give dmenu
|
||||||
# some choice programs to use to open it.
|
# some choice programs to use to open it.
|
||||||
|
|
||||||
# The URL will be shown visually in 30 characters or less.
|
x=$(printf "mpv\\nmpv (loop)\\nwget\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")
|
||||||
if [[ "${#1}" -gt 30 ]];
|
|
||||||
then
|
|
||||||
visual="${1:0:20}"..."${1: -7}"
|
|
||||||
else
|
|
||||||
visual="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
x=$(echo -e "mpv\nmpv (loop)\nwget\nfeh\nbrowser\nw3m\nmpv (float)" | dmenu -i -p "How should I open '$visual'?")
|
|
||||||
case "$x" in
|
case "$x" in
|
||||||
mpv) mpv -quiet "$1" 2&>/dev/null & disown ;;
|
mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;;
|
||||||
"mpv (loop)") mpv -quiet --loop "$1" 2&>/dev/null & disown ;;
|
"mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;;
|
||||||
wget) wget "$1" 2&>/dev/null & disown ;;
|
wget) wget "$1" >/dev/null 2>&1 ;;
|
||||||
browser) setsid nohup $TRUEBROWSER "$1" & disown ;;
|
browser) setsid "$TRUEBROWSER" "$1" & ;;
|
||||||
feh) feh "$1" 2&>/dev/null & disown ;;
|
feh) setsid feh "$1" >/dev/null 2>&1 & ;;
|
||||||
w3m) w3m "$1" 2&>/dev/null & disown ;;
|
w3m) w3m "$1" >/dev/null 2>&1 ;;
|
||||||
"mpv (float)") mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" 2&>/dev/null & disown ;;
|
"mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue