diff options
| author | Mitsuo Tokumori <mitsuo@tokumori.xyz> | 2025-12-30 01:17:10 +0900 |
|---|---|---|
| committer | Mitsuo Tokumori <mitsuo@tokumori.xyz> | 2025-12-30 01:17:10 +0900 |
| commit | 897ffe7b3ba43fee0c4418148a185d1cbb7d6425 (patch) | |
| tree | 9d5fca789746ebb9b8a99902b7aa66b0f6bde2c5 /public/.local/bin/myfile-handler.sh | |
| parent | d0a3fa2ddd2843a55cce25d29fe61daf27ef1d38 (diff) | |
QoL small changes
Diffstat (limited to 'public/.local/bin/myfile-handler.sh')
| -rwxr-xr-x | public/.local/bin/myfile-handler.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/public/.local/bin/myfile-handler.sh b/public/.local/bin/myfile-handler.sh index 52496cd..df57a9a 100755 --- a/public/.local/bin/myfile-handler.sh +++ b/public/.local/bin/myfile-handler.sh @@ -1,8 +1,15 @@ #!/bin/bash # A script to handle custom protocol -url="$1" +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" |
