blob: 7ad0591e4bcf719655abfacd2b4a4ae8c1a3a994 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
open_func() {
file="$1"
IFS='/' read -r major minor < <(file -ib "$file" 2>/dev/null | cut -d ';' -f 1)
case "$major/$minor" in
text/html)
firefox "$file" &;;
application/pdf)
zathura "$file" &;;
image/*)
feh "$file" &;;
text/*)
xterm -e vim "$file" &;;
video/*)
mpv "$file" &;;
*)
/usr/bin/xdg-open "$file";;
esac
}
command -v open >/dev/null 2>&1 && alias o=open || alias o=open_func
|