annotate bin/setdefaultbrowser.sh @ 727:03b66f90916f

works
author Jeff Hammel <k0scist@gmail.com>
date Tue, 02 Dec 2014 13:59:37 -0800
parents 5af627460928
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
0694882a1ad8 moar dox!
Jeff Hammel <jhammel@mozilla.com>
parents: 341
diff changeset
3 # To get all selections:
500
5af627460928 changes
Jeff Hammel <jhammel@mozilla.com>
parents: 345
diff changeset
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
0694882a1ad8 moar dox!
Jeff Hammel <jhammel@mozilla.com>
parents: 341
diff changeset
6 # To get a particular selection:
0694882a1ad8 moar dox!
Jeff Hammel <jhammel@mozilla.com>
parents: 341
diff changeset
7 # update-alternatives --display x-www-browser
0694882a1ad8 moar dox!
Jeff Hammel <jhammel@mozilla.com>
parents: 341
diff changeset
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
0694882a1ad8 moar dox!
Jeff Hammel <jhammel@mozilla.com>
parents: 341
diff changeset
30 # unlink ${LINKPATH}
0694882a1ad8 moar dox!
Jeff Hammel <jhammel@mozilla.com>
parents: 341
diff changeset
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