The easiest way to set default browser is to simply set BROWSER environment variable in ~/.xinitrc or ~/.xsession (I link .xsession to .xinitrc). This works well for many apps, however there are many other apps, that require you to select default browser manually in their settings or configuration files (xpdf for example).
There are 2 simple ways to deal with this:
- make symbolic link from ~/bin/browser to your favorite browser app
- make wrappers script and place it in ~/bin/
- (ok, there's third) simply set browser app directly
- Simply setting default browser directly in configuration files or settings can be problematic, because when you change default browser, you will have to change all settings for all apps that doesn't respect $BROWSER environment variable. This approach also might suffer from portability issue (however that's not always the case)
- Symbolic link won't be portable. many Linuxes install apps in very different directory (not a big problem, if you work with one OS), however if you work with BSD and Linux, or different Linux distros, then this can be a problem. On some OSes your link will work, on some it will fails (unless you don't sync your home).
- It's portable
- You can change default browser, and all apps that use this wrapper script will use new browser without modification to their configs and/or settings
- You can set default options for some browsers (chromium for example)
case $MY_BROWSER in
'chrome' | 'chromium' ) exec $MY_BROWSER $CHROME_CMDL $* ;;
*) exec $MY_BROWSER $* ;;
This script is part of my wmscripts. It reads settings from $WMSCRIPTS_DIR/config file, where I set CHROME_CMDL parameters.
You can set MY_BROWSER as environment variable, or set it in $WMSCRIPTS_DIR/config file :)
If you decide to use browser.sh script, then set BROWSER environment variable to point to browser.sh script, set WMSCIPTS_DIR environment variable (or modify script to fit your needs), then set MY_BROWSER in $WMSCRIPTS_DIR/config or set it as environment variable. And finally tell all apps that doesn't support BROWSER environment variable to use use browser.sh script. That's it.
Now whenever you decide to change your default browser, you simply need to modify MY_BROWSER. BTW, is probably easier to set MY_BROWSER in $WMSCRIPTS_DIR/config, because for environment variable to be updated on your minimal desktop, you'll need to log out, and then log in every time you change it.