Без опису

BezierQuadratic a35fc21ff8 Use file instead of xdg-mime 1 рік тому
LICENSE.md 1ff6883535 Initial commit 2 роки тому
README.md 1ff6883535 Initial commit 2 роки тому
example.config 7ef1d3966a Added default config 1 рік тому
fileopener.sh a35fc21ff8 Use file instead of xdg-mime 1 рік тому

README.md

Fileopener

Simple mime-based file opener

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.

Configuration

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" )