Last active
March 27, 2021 13:14
-
-
Save bobf/ec82435c2030f4c6d1c8ed313f6ad65f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
mode="$1" | |
url="$2" | |
chromium_standard='chromium' | |
chromium_private='chromium --incognito' | |
firefox_standard='firefox' | |
firefox_private='firefox --private-window' | |
if pgrep 'chromium' >/dev/null 2>&1 | |
then | |
browser="chromium_${mode}" | |
else | |
browser="firefox_${mode}" | |
fi | |
echo "Launching: ${!browser} $2" | |
${!browser} "$2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/share/applications/dynamic-browser.desktop | |
[Desktop Entry] | |
Version=1.0 | |
Comment=Access the Internet | |
StartupNotify=true | |
Terminal=false | |
Icon=chromium | |
Type=Application | |
Categories=Network;WebBrowser; | |
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/ftp;x-scheme-handler/http;x-scheme-handler/https; | |
Actions=new-window;new-private-window; | |
[Desktop Action new-window] | |
Name=New Window | |
Exec=/usr/local/bin/dynamic-browser standard | |
[Desktop Action new-private-window] | |
Name=New Private Window | |
Exec=/usr/local/bin/dynamic-browser private |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment