summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-07-03 17:04:50 +0530
committersinanmohd <sinan@firemail.cc>2023-07-03 17:04:50 +0530
commit76c5f62548c60492a40aaff56655b83de5991944 (patch)
tree88f2aa94d0ff617ab577de294fe6e443eb11251c
parent9991723d469eefc139d90b8ddf9f9c5e4eba3a79 (diff)
linkhandler: can now detect onion urls not just domains
-rwxr-xr-x.local/bin/linkhandler9
1 files changed, 5 insertions, 4 deletions
diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler
index cae7192..71bdbef 100755
--- a/.local/bin/linkhandler
+++ b/.local/bin/linkhandler
@@ -28,11 +28,12 @@ main()
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" &&
exec "$TERMINAL" -e xdg-open "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" > /dev/null 2>&1 &
;;
- *.onion)
- exec tor-browser "$1" >/dev/null 2>&1
- ;;
*)
- exec "$BROWSER" "$1" >/dev/null 2>&1
+ if echo "$1" | grep -Eqx '^https?://[^/]*\.onion(/.*)?'; then
+ exec tor-browser "$1" >/dev/null 2>&1
+ else
+ exec "$BROWSER" "$1" >/dev/null 2>&1
+ fi
;;
esac
}