qutebrowser: Make xdg-utils optional

Replace all hard-coded instances of using xdg-open with at least one
non-xdg alternative. Mostly falling back to either mimeo or a custom
open script.
This commit is contained in:
Marty Oehme 2025-03-19 21:28:56 +01:00
parent ff2ae79878
commit d69a0f40e1
Signed by: Marty
GPG key ID: 4E535BC19C61886E
5 changed files with 41 additions and 8 deletions

View file

@ -12,6 +12,16 @@
# Configure your wallabag instance with this:
WALLABAG_INSTANCE="https://read.martyoeh.me"
_open() {
if command -v open >/dev/null 2>&1; then
open "$1" &
elif command -v mimeo >/dev/null 2>&1; then
mimeo "$1" &
else
xdg-open "$1" &
fi
}
# only works for wallabag v2.*
if [ "$#" -gt 0 ]; then
BM="$WALLABAG_INSTANCE/bookmarklet?url=$*"
@ -22,5 +32,5 @@ fi
if [ -n "$QUTE_FIFO" ]; then
echo "open -b -r $BM" >>"$QUTE_FIFO"
else
xdg-open "$BM"
_open "$BM"
fi