BezierQuadratic a35fc21ff8 Use file instead of xdg-mime | пре 1 година | |
---|---|---|
LICENSE.md | пре 2 година | |
README.md | пре 2 година | |
example.config | пре 1 година | |
fileopener.sh | пре 1 година |
It opens the file trying to use the URL type, the file extension, and the mime type (in that order), recognizing only exactly the types that have been specified by the user, no guesswork is made by the program (except for application-types, which can be run directly), unlike other more bloated openers.
The program looks for ~/.config/fileopener.config and /etc/fileopener.config (in that order), if neither of them is found it fails.
The configuration file is comprised of 9 Bash arrays (syntax: name=("value 1" "value 2" ... "value n")
), as the following example:
# First of all, there are the three arrays that define the recognized types
url_types=( "https?://" "magnet:\?" ) # Unlike all the other arrays, this one is regexes instead of plain strings
extensions=( "pdf" "jpg" )
mime_types=( "text" "video" ) # Unlike other mime openers, this one only uses the primary mime type
# Then there are the arrays to decide what to open, the program is chosen based on its position in the array
# There are 2 sets of arrays: one for when Fileopener is called from a terminal, and one for when it's not
url_openers=( "qutebrowser" "qbittorrent" )
extension_openers=( "mupdf" "sxiv" )
mime_openers=( "xterm -e vim" "mpv" )
url_openers_terminal=( "lynx" "qbittorrent" )
extension_openers_terminal=( "mupdf" "chafa" )
mime_openers_terminal=( "vim" "mpv" )