This repository has been archived on 2022-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/scripts/.local/bin/xdg-open

37 lines
648 B
Bash
Executable File

#!/bin/sh
case $1 in
*youtube.com*)
mpv --ytdl-format='bestvideo[height<=1080]+bestaudio' $1
;;
*mp3)
mpv "$1"
;;
http://*|https://*)
if [ $(cat /etc/hostname) = 'alarm' ]
then
exec firefox "$1"
else
exec qutebrowser "$1"
fi
;;
gemini://*)
exec lagrange "$1"
;;
mailto://*)
exec thunderbird "$1"
;;
*.pdf)
exec evince "$1"
;;
*.txt)
exec gedit "$1"
;;
*/)
exec Thunar "$1"
;;
*)
notify-send "no handler for $1, using system xdg"
exec /usr/bin/xdg-open "$@"
;;
esac