Skip to content

Instantly share code, notes, and snippets.

@simonbru
Created January 24, 2019 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonbru/721c11287f28a46d0c30ebed4c8fb562 to your computer and use it in GitHub Desktop.
Save simonbru/721c11287f28a46d0c30ebed4c8fb562 to your computer and use it in GitHub Desktop.
Set a different default browser for every workspace

Custom browser launcher

Usage

  • Install xdotool
  • Modify launch_browser.sh to use the right browser for the right workspace
  • Change the path to launch_browser.sh in launch-browser.desktop
  • Copy launch-browser.desktop into ~/.local/share/applications/
  • Set this script as the default browser: xdg-settings set default-web-browser launch-browser.desktop
[Desktop Entry]
Type=Application
Name=Custom browser launcher
Exec=/absolute/path/to/launch_browser.sh %u
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
#!/bin/sh
CURRENT_WORKSPACE="$(xdotool get_desktop)"
case "$CURRENT_WORKSPACE" in
[0-1])
# Workspaces 0 and 1
browser=firefox
;;
*)
# Every other workspace
browser=chromium
;;
esac
exec "$browser" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment