Skip to content

Instantly share code, notes, and snippets.

@skatkov
Forked from cesarolea/choosy
Last active January 12, 2025 16:31
Show Gist options
  • Save skatkov/221b4f302779385494d9dfb9e9eb6aac to your computer and use it in GitHub Desktop.
Save skatkov/221b4f302779385494d9dfb9e9eb6aac 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}')
# Read the list of domains from the file
DOMAIN_LIST=$(cat /home/sk/.config/url-list.txt)
# Check if the domain is in the list
if echo "$DOMAIN_LIST" | grep -q "$DOMAIN"; then
firefox-developer-edition "$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;
code.corp.indeed.com
app.slack.com
www.notion.so/syftapp
id.indeedflex.com
id.indeed.tech
indeed.atlassian.net
@skatkov
Copy link
Author

skatkov commented Jan 7, 2025

My forked version of choosy script adjusted to my needs and slightly simplified.

Installation

Copy choosy to system path and make it executable

sudo cp choosy ~/bin/
sudo chmod +x ~/bin/choosy

Copy choosy.desktop to ~/.local/share/applications/

cp choosy.desktop ~/.local/share/applications/

Move url-list.txt file to ~/.config folder

cp url-list.txt ~/.config

Go to System Setting -> Default Application -> Pick "Choosy" as a default web browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment