From fdc161b3fffda21a3bbe04963d4490bb13a805fd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 7 Apr 2018 09:25:57 -0700 Subject: [PATCH] dmenuhandler script added --- .config/i3/i3_guide.rmd | 7 +------ .newsboat/config | 2 ++ .scripts/dmenuhandler | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100755 .scripts/dmenuhandler diff --git a/.config/i3/i3_guide.rmd b/.config/i3/i3_guide.rmd index 4038ab7..0ea3a44 100644 --- a/.config/i3/i3_guide.rmd +++ b/.config/i3/i3_guide.rmd @@ -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 diff --git a/.newsboat/config b/.newsboat/config index d81e597..2ef689b 100644 --- a/.newsboat/config +++ b/.newsboat/config @@ -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 diff --git a/.scripts/dmenuhandler b/.scripts/dmenuhandler new file mode 100755 index 0000000..227ef04 --- /dev/null +++ b/.scripts/dmenuhandler @@ -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