link-handler.sh - dotfiles - These are my dotfiles. There are many like it, but these are mine.
(HTM) git clone git://jay.scot/dotfiles
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
link-handler.sh (760B)
---
1 #!/bin/sh
2
3 launcher="setsid"
4
5 # applications
6 player="mpv --autofit=30% --really-quiet --no-terminal"
7 gemini="foot -e amfora"
8 gopher="foot -e lynx"
9 pdf="zathura"
10 images="swayimg"
11 torrent="qbittorrent"
12 browser="foot -e rdrview"
13
14 uri="$1"
15 uri_lower="$(printf "%s" "$uri" | tr '[:upper:]' '[:lower:]')"
16
17 case "$uri_lower" in
18 *.mkv | *.mp4 | *.webm | *youtube.com* | *odysee.com*)
19 $player "$uri" &
20 ;;
21 *.gmi | gemini:*)
22 $launcher $gemini "$uri"
23 ;;
24 gopher:*)
25 $gopher "$uri" &
26 ;;
27 magnet:*)
28 $launcher "$torrent" "$uri" &
29 ;;
30 *.pdf | *.ps | *.epub)
31 $launcher "$pdf" "$uri"
32 ;;
33 *.jpg | *.jpe | *.jpeg | *.png | *.gif | *.webp)
34 $launcher "$images" "$uri"
35 #$launcher wget -qO- "$uri" | "$images" -
36 ;;
37 *)
38 $launcher $browser "$uri"
39 ;;
40 esac