Dotfiles/bin/.bin/linkhandler
Jonathan Hodgson 99736427be BIN: Deletes open-youtube and puts functionality in yt
The yt script now accepts a --url option which will take a url as an
option like

yt --url youtube.com/watch?v=blar
or
echo youtube.com/watch?v=blar | yt --url

It will also use rofi rather than fzf if not being run from a terminal
or the --rofi flag is given

I have updated the files that used to use open-youtube to reflect this
2021-07-30 13:14:50 +01:00

21 lines
553 B
Bash
Executable file

#!/usr/bin/env bash
# A script to open urls
# For example, open images with sxiv
# This is necesary becuase environment variables are lost when calling from newsboat for some reason
url="$1"
browser="${BROWSER:-firefox-developer-edition}"
case "$url" in
*"//invidious.*/"*) yt --url "$url"; exit 0 ;;
*//*.youtube.*/*) yt --url "$url"; exit 0 ;;
*"//videos.*"*) yt --url "$url"; exit 0 ;;
*"//xkcd.com/"*) xkcd "$url"; exit 0 ;;
"mailto:"*) neomutt "$url"; exit 0 ;;
*) $browser "$url"; exit 0 ;;
#*) notify-send "$url"; exit ;;
esac
exit 1