Handling files by name. Takes precedence over mimes.

This commit is contained in:
Jack L. Frost 2014-11-21 13:48:09 +03:00
parent 93ec32f793
commit 545447c9b0
2 changed files with 14 additions and 0 deletions

View File

@ -23,6 +23,15 @@ handle_uri() {
handle_fs_target() {
local target="${1##*file://}"
target_filename="${target##*/}"
for n in "${!filename_handlers[@]}"; do
[[ "$target_filename" =~ ${filename_handlers[${n}]} ]] && {
${n} "$target" &
return 0
}
done
target_mimetype=$(file -ib "$target")
for m in "${!mime_handlers[@]}"; do

View File

@ -3,12 +3,17 @@
declare -A uri_handlers
declare -A mime_handlers
declare -A filename_handlers
uri_handlers=(
["steam"]='^steam://.+'
["browser"]='.+'
)
filename_handlers=(
["javaws"]='^kvm.+?\.cgi$'
)
mime_handlers=(
["sxiv"]='image/.+'
)