Mercurial > hg > config
annotate bin/setdefaultbrowser.sh @ 767:35f8751c0930
it is very annoying to have ones overrides overridden; see also http://stackoverflow.com/questions/25381304/why-type-cd-on-mac-os-states-that-cd-is-a-function
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Thu, 28 Jan 2016 14:02:17 -0800 |
parents | 5af627460928 |
children |
rev | line source |
---|---|
341
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 #!/bin/bash |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 |
345 | 3 # To get all selections: |
500 | 4 # update-alternatives --get-selections |
341
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 |
345 | 6 # To get a particular selection: |
7 # update-alternatives --display x-www-browser | |
8 | |
341
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 # http://askubuntu.com/questions/100693/how-can-i-manually-change-the-default-web-browser |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 # http://askubuntu.com/questions/45885/how-do-i-set-a-custom-browser-as-default-in-preferred-applications?rq=1 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 # http://fvue.nl/wiki/Linux:_Default_browser |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 # cat /proc/$(pidof krunner)/environ | tr '\000' '\012' | grep BROWSER |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 if [[ $(whoami) != 'root' ]] |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 then |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 echo "Must be run as root" |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 exit 1 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 fi |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 BROWSER=/home/jhammel/firefox/firefox |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 PREFIX=/usr/bin |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 for LINK in gnome-www-browser x-www-browser |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 do |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 LINKPATH=${PREFIX}/${LINK} |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 update-alternatives --install ${LINKPATH} ${LINK} ${BROWSER} 99 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
27 update-alternatives --install ${LINKPATH} ${LINK} ${BROWSER} 99 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
28 update-alternatives --set ${LINK} ${BROWSER} |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
29 update-alternatives --display ${LINK} |
345 | 30 # unlink ${LINKPATH} |
31 # ln -s ${BROWSER} ${LINKPATH} | |
341
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
32 done |