dmenuhandler script added

This commit is contained in:
Luke Smith 2018-04-07 09:25:57 -07:00
parent de034ec982
commit fdc161b3ff
3 changed files with 26 additions and 6 deletions

View file

@ -96,13 +96,8 @@ Be sure you play around with these. Be flexible with the basic commands and the
+ Mod+F2 -- Refresh i3
+ Mod+F3 -- Select screen/display to use
+ Mod+F4 -- Hibernate
+ Mod+F6 -- transmission torrent client (cli)
+ Mod+F5 -- Reset Network Manager, search for new networks
+ Mod+F7 -- (No mapping)
+ Mod+F8 -- (No mapping)
+ Mod+F10 -- Switch to laptop screen
+ Mod+F11 -- Switch to VGA display (if available)
+ Mod+F12 -- Switch to dual VGA/laptop display (if available)
+ Mod+F6 -- transmission torrent client (cli)
## Audio

View file

@ -19,6 +19,7 @@ bind-key n next-unread
bind-key N prev-unread
bind-key D pb-download
bind-key U show-urls
bind-key x pb-delete
color listnormal cyan default
color listfocus black yellow standout bold
@ -32,6 +33,7 @@ macro , open-in-browser
macro v set browser "i3 exec mpv"; open-in-browser ; set browser linkhandler
macro y set browser "spawndl"; open-in-browser ; set browser linkhandler
macro w set browser "w3m"; open-in-browser ; set browser linkhandler
macro p set browser "dmenuhandler"; open-in-browser ; set browser linkhandler
# c copies the link to the clipboard.
# The line below is probably the skiddiest line I've ever written.
macro c set browser "copy(){ echo $1 | xclip ;}; copy "; open-in-browser ; set browser linkhandler

23
.scripts/dmenuhandler Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Feed this script a link and it will give dmenu
# some choice programs to use to open it.
# The URL will be shown visually in 30 characters or less.
if [[ "${#1}" -gt 30 ]];
then
visual="${1:0:20}"..."${1: -7}"
else
visual="$1"
fi
echo $visual
x=$(echo -e "mpv\nmpv (loop)\nwget\nfeh\nbrowser\nw3m\nmpv (float)" | dmenu -i -p "How should I open '$visual'?")
case "$x" in
mpv) mpv -quiet "$1" 2&>/dev/null & disown ;;
"mpv (loop)") mpv -quiet --loop "$1" 2&>/dev/null & disown ;;
wget) wget "$1" 2&>/dev/null & disown ;;
browser) $BROWSER "$1" 2&>/dev/null & disown ;;
feh) feh "$1" 2&>/dev/null & disown ;;
w3m) w3m "$1" 2&>/dev/null & disown ;;
"mpv (float)") mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" /dev/video0 "$1" 2&>/dev/null & disown ;;
esac