From 12cf2f929b7797716b5f9bcb6abe0042b9cd0409 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sun, 14 May 2023 12:54:54 -0400 Subject: [PATCH] qutebrowser: add fixlink userscript --- src/.config/qutebrowser/config.py | 4 ++++ .../share/qutebrowser/userscripts/fixlink.sh | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 src/.local/share/qutebrowser/userscripts/fixlink.sh diff --git a/src/.config/qutebrowser/config.py b/src/.config/qutebrowser/config.py index 3371109..30f175b 100644 --- a/src/.config/qutebrowser/config.py +++ b/src/.config/qutebrowser/config.py @@ -102,3 +102,7 @@ c.hints.selectors["code"] = [ "pre" ] config.bind("cc", "hint code userscript code_select.py") + +# use libre redirects +config.bind(",fl", "hint links userscript fixlink.sh") +config.bind(",fL", "hint links userscript fixlink.sh -t") diff --git a/src/.local/share/qutebrowser/userscripts/fixlink.sh b/src/.local/share/qutebrowser/userscripts/fixlink.sh new file mode 100755 index 0000000..1312a22 --- /dev/null +++ b/src/.local/share/qutebrowser/userscripts/fixlink.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# libredirect but scuffed and a qutebrowser userscript +# +# bind something like this in config.py +# +# config.bind(",fl", "hint links userscript fixlink.sh") +# config.bind(",fL", "hint links userscript fixlink.sh -t") +# + +REDDIT="lr.mint.lgbt" +TWITTER="nitter.net" +# genius lyrics +GENIUS="sing.whatever.social" +YOUTUBE="yewtu.be" + +LINK="$(printf "%s" "$QUTE_URL" | sed \ + -e "s/www.reddit.com/$REDDIT/g" \ + -e "s/twitter.com/$TWITTER/g" \ + -e "s/genius.com/$GENIUS/g" \ + -e "s/youtube.com/$YOUTUBE/g")" + +echo "open $1 $LINK" >> "$QUTE_FIFO"