changeset 341:4387fa22807f

what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 22 Jun 2013 09:54:06 -0700
parents 576edf9dee2e
children 481b55fc4b96
files bin/setdefaultbrowser.sh
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/setdefaultbrowser.sh	Sat Jun 22 09:54:06 2013 -0700
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# sudo update-alternatives --get-selections
+
+# http://askubuntu.com/questions/100693/how-can-i-manually-change-the-default-web-browser
+# http://askubuntu.com/questions/45885/how-do-i-set-a-custom-browser-as-default-in-preferred-applications?rq=1
+# http://fvue.nl/wiki/Linux:_Default_browser
+
+# cat /proc/$(pidof krunner)/environ | tr '\000' '\012' | grep BROWSER
+
+if [[ $(whoami) != 'root' ]]
+then
+   echo "Must be run as root"
+   exit 1
+fi
+
+BROWSER=/home/jhammel/firefox/firefox
+PREFIX=/usr/bin
+for LINK in gnome-www-browser x-www-browser
+do
+    LINKPATH=${PREFIX}/${LINK}
+    update-alternatives --install ${LINKPATH} ${LINK} ${BROWSER} 99
+    update-alternatives --install ${LINKPATH} ${LINK} ${BROWSER} 99
+    update-alternatives --set ${LINK} ${BROWSER}
+    update-alternatives --display ${LINK}
+    echo
+    unlink ${LINKPATH}
+    ln -s  ${BROWSER} ${LINKPATH}
+done