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 shaarli instance with this:
SHAARLI_INSTANCE="https://links.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
}
# send page to shaarli instance and open the 'post' page to edit it
if [ "$#" -gt 0 ]; then
BM="$SHAARLI_INSTANCE/?post=$*"
@ -22,6 +32,6 @@ fi
if [ -n "$QUTE_FIFO" ]; then
echo "open -t -r $BM" >>"$QUTE_FIFO"
else
xdg-open "$BM"
_open "$BM"
fi