newsboatpiper.bash (1155B)
1 #!/usr/bin/env bash 2 # 3 # ??? who ??? cirrus 4 # https://github.com/newsboat/newsboat/issues/23 5 # http://arza.us/paste/piper 6 7 # 8 # newsboatpiper.bash 9 # If you use weechat-curses or irssi it also works well when you set the script 10 # as the terminal emulators browser. 11 # youtube urls and more will auto open in mpv, all hyperlinks and local files 12 # ending in .jpg, .png etc will open in feh. 13 # A function containing a case list of options 14 open() { 15 case "$1" in 16 *youtube.com*|*youtu.be*|*vodlocker.com*|*.webm*|*.mp4*|*.avi) mpv "$1";; 17 # *.PNG|*.JPG|*.png|*.jpeg|*.gif*|*.jpg) feh -. "$1";; # feh -. = opens to fit window. 18 # wordpress images 19 *.PNG|*.JPG|*.png|*.jpeg|*.gif*|*.jpg|*.png??????|*.jpeg??????|*.gif??????|*.jpg??????) feh -. "$1";; # feh -. = opens to fit window. 20 # *) firefox "$1"; # For everything else.; 21 *) elinks -remote "$1"; # For everything else.; 22 esac 23 } 24 # Now a for loop to iterate the list of options, 25 for url; do 26 open "$url" 27 done 28 29 30 31 # factory recomendation 32 #browser "~/bin/newsboat-browser.sh" 33 # #/bin/sh 34 # /usr/bin/firefox "$@" & 35 # $ chmod +x ~/bin/newsboat-browser.sh