#!/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"