Skip to content

Instantly share code, notes, and snippets.

@ssokolow
Created August 25, 2019 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssokolow/5b59998d2245325758ac9bbf462605c2 to your computer and use it in GitHub Desktop.
Save ssokolow/5b59998d2245325758ac9bbf462605c2 to your computer and use it in GitHub Desktop.
Helper script to override Firefox's attempt to open .cbz files as Zip files, regardless of OS file associations
#!/bin/sh
# NOTE: Despite this script using KDE commands like ark and kdialog, Firefox
# doesn't obey KDE's file associations, so you'll need to use a non-KDE
# file manager like PCManFM to edit the file associations.
open_zip() {
exec ark "$@"
}
offer_comix() {
if kdialog --yesno 'File appears to be a Comic Book Archive\nOpen in Comix instead?'; then
exec comix "$@"
else
open_zip "$@"
fi
}
case "$1" in
(*.[cC][bB][zZ]) offer_comix "$@";;
*) open_zip "$@";;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment