blob: df57a9a03866dbe47b5c62353597cf200c113686 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#!/bin/bash
# A script to handle custom protocol
notify() {
mimetype=$(xdg-mime query filetype "$file_path")
defaultprogram=$(xdg-mime query default "$mimetype")
notify-send "Opening $(basename $file_path) ($mimetype) with $defaultprogram"
}
url="$1"
file_path="${url#myfile://}"
file_path=$(echo "$file_path" | sed 's/%20/ /g')
file_path="${file_path/\~/$HOME}"
notify
xdg-open "$file_path"
|