Handling files by name. Takes precedence over mimes.
This commit is contained in:
parent
93ec32f793
commit
545447c9b0
9
sx-open
9
sx-open
|
@ -23,6 +23,15 @@ handle_uri() {
|
||||||
handle_fs_target() {
|
handle_fs_target() {
|
||||||
local target="${1##*file://}"
|
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")
|
target_mimetype=$(file -ib "$target")
|
||||||
|
|
||||||
for m in "${!mime_handlers[@]}"; do
|
for m in "${!mime_handlers[@]}"; do
|
||||||
|
|
|
@ -3,12 +3,17 @@
|
||||||
|
|
||||||
declare -A uri_handlers
|
declare -A uri_handlers
|
||||||
declare -A mime_handlers
|
declare -A mime_handlers
|
||||||
|
declare -A filename_handlers
|
||||||
|
|
||||||
uri_handlers=(
|
uri_handlers=(
|
||||||
["steam"]='^steam://.+'
|
["steam"]='^steam://.+'
|
||||||
["browser"]='.+'
|
["browser"]='.+'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
filename_handlers=(
|
||||||
|
["javaws"]='^kvm.+?\.cgi$'
|
||||||
|
)
|
||||||
|
|
||||||
mime_handlers=(
|
mime_handlers=(
|
||||||
["sxiv"]='image/.+'
|
["sxiv"]='image/.+'
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user