Skip to content

Instantly share code, notes, and snippets.

@iul1an
Forked from cesarolea/choosy
Created March 19, 2023 19:20
Show Gist options
  • Save iul1an/654cb7e3a0af4ea19bf9caccd1158593 to your computer and use it in GitHub Desktop.
Save iul1an/654cb7e3a0af4ea19bf9caccd1158593 to your computer and use it in GitHub Desktop.
Open browser based off of certain rules (like choosy for macOS)
#!/bin/bash
URL=$1
DOMAIN=$(echo "$URL" | awk -F[/:] '{print $4}')
## Domain starts with
if [[ $DOMAIN =~ $(echo ^\($(paste -sd'|' /home/your-user/.config/url-start.txt)\)$) ]]; then
chromium-browser "$URL" & disown
elif [[ $DOMAIN =~ $(echo ^\($(paste -sd'|' /home/your-user/.config/url-is.txt)\)$) ]]; then
firefox "$URL" & disown
else
firefox "$URL" & disown
fi
[Desktop Entry]
Name=Choosy
GenericName=Browser Chooser
Comment=Choose what browser to use for specific links
Categories=Network;
Exec=choosy %u
Type=Application
MimeType=x-scheme-handler/unknown;x-scheme-handler/about;text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
https://www.mozilla.org
drive.google.com
docs.google.com
meet.google.com
app.gotomeeting.com
hangouts.google.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment