# vim: ft=cfg #------------------------------------------- # Environment checks #------------------------------------------- #------------------------------------------- # Websites #------------------------------------------- ext x?html?, has brave, X, flag f = brave -- "$@" ext x?html?, has firefox, X, flag f = firefox -- "$@" ext x?html?, has chromium, X, flag f = chromium -- "$@" ext x?html?, has lynx, terminal = lynx -- "$@" ext x?html?, has w3m, terminal = w3m "$@" #------------------------------------------- # Misc #------------------------------------------- label editor, mime ^text|x-empty$ = ${VISUAL:-$EDITOR} -- "$@" label pager, mime ^text|x-empty$ = $PAGER -- "$@" label editor, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php|dart = ${VISUAL:-$EDITOR} -- "$@" label pager, ext xml|json|csv|tex|py|pl|rb|rs|js|sh|php|dart = $PAGER -- "$@" #-------------------------------------------- # Audio without X #------------------------------------------- mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" #-------------------------------------------- # Video/Audio with a GUI #------------------------------------------- mime ^video, has mpv, X, flag f = mpv -- "$@" mime ^video|^audio, has vlc, X, flag f = vlc -- "$@" #-------------------------------------------- # Video without X: #------------------------------------------- mime ^video, terminal, !X, has mpv = mpv -- "$@" #------------------------------------------- # Documents #------------------------------------------- ext djvu, has zathura, X, flag f = zathura -- "$@" ext epub, has zathura, X, flag f = zathura -- "$@" ext cb[rz], has zathura, X, flag f = zathura -- "$@" ext pdf, has zathura, X, flag f = zathura -- "$@" ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" ext docx?, has catdoc, terminal = catdoc -- "$@" | $PAGER ext sc, has sc, = sc -- "$@" #------------------------------------------- # Images #------------------------------------------- mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" mime ^image/svg, has display, X, flag f = display -- "$@" mime ^image, has nsxiv, X, flag f = nsxiv -- "$@" mime ^image, has sxiv, X, flag f = sxiv -- "$@" mime ^image, has gimp, X, flag f = gimp -- "$@" mime ^image, has krita, X, flag f = krita -- "$@" ext xcf, has gimp, X, flag f = gimp -- "$@" ext kra, has krita, X, flag f = krita -- "$@" #------------------------------------------- # Archives #------------------------------------------- ext 7z, has 7z = 7z -p l "$@" | $PAGER ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | $PAGER ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | $PAGER ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@" ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@" # Listing and extracting archives without atool: ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | $PAGER ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done ext zip, has unzip = unzip -l "$1" | less ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done ext ace, has unace = unace l "$1" | less ext ace, has unace = for file in "$@"; do unace e "$file"; done ext rar, has unrar = unrar l "$1" | less ext rar, has unrar = for file in "$@"; do unrar x "$file"; done #------------------------------------------- # Fonts #------------------------------------------- mime ^font, has fontforge, X, flag f = fontforge "$@" #------------------------------------------- # Flag t fallback terminals #------------------------------------------- mime ^ranger/x-terminal-emulator, has st = st -e "$@" mime ^ranger/x-terminal-emulator, has xterm = xterm -e "$@" #------------------------------------------- # Fallback #------------------------------------------- else = ask label open, has xdg-open = xdg-open "$@" label open, has open = open -- "$@" ###################################################################### # The actions below are left so low down in this file on purpose, so # # they are never triggered accidentally. # ###################################################################### # Execute a file as program/script. mime application/x-executable = "$1" # Move the file to trash using trash-cli. label trash, has trash-put = trash-put -- "$@"