Keys

From Foomagic

Jump to: navigation, search
 
 ###Make sure you have a .xmodmap file mapping your forward/back keys to F19 and F20
 ###Save this script and make it executable and place it in /usr/local/bin
 ###Run it as root after you have upgraded Firefox 
 ###Restart Firefox and your forward/back keys should be enabled
 ###Modified to include support for firefox-1.5 and older versions also
 
 #!/bin/bash
 
 set -x
 set -e
 
 PACKAGE=/usr/bin/unzip
 OTHER=/usr/bin/zip
 FILE=/usr/lib/firefox/chrome/browser/content/browser/browser.xul
 ICEWEASEL=/usr/lib/iceweasel/chrome/browser/content/browser/browser.xul
 SED_CMD="sed -e '/<key id=\"goBackKb\"./a\    <key id=\"goBackKb2\" keycode=\"VK_F19\" command=\"Browser:Back\"\/>'  
 -e '/<key id=\"goForwardKb\"./a\    <key id=\"goBackKb2\" keycode=\"VK_F20\" command=\"Browser:Forward\"\/>'"
 
 ECHO=(echo -e "\033[1mPlease restart firefox for changes to take place\033[0m")
 
 if 
 [ -a $FILE ]
 then 
	 eval "$SED_CMD" $FILE > $FILE.new; mv $FILE.new $FILE
	 $ECHO
			exit
				fi
 if
 [ -a $ICEWEASEL ]
 then 
   eval "$SED_CMD" $ICEWEASEL > $ICEWEASEL.new; mv $ICEWEASEL.new $ICEWEASEL
	 ${ECHO[@]}
		exit
			fi
 
 if 
 [ -a  /usr/lib/mozilla-firefox/chrome/browser.jar ] || [ -a /usr/lib/firefox/chrome/browser.jar ]
      
     	then :
		else
			echo -e "\033[1mYou dont seem to have Firefox installed, or this script needs modifying again \033[0m"
				exit
					fi	
 if
 [ -x $PACKAGE ]
	then :
  	          else
  	               echo -e "\033[1mYou dont seem to have unzip installed, please install it and try again.\033[0m"
       			       fi
 if
 [ -x $OTHER ]
	then :
	          else 
			echo -e "\033[1mYou dont seem to have zip installed, please install it and try again.\033[0m"
				exit
					fi
 if 
 [ -a /usr/lib/mozilla-firefox/chrome/browser.jar ]
	then
		DIR=/usr/lib/mozilla-firefox/chrome
	else
		DIR=/usr/lib/firefox/chrome
	fi
 
 unzip -q $DIR/browser.jar -d /tmp/firefox/
 TMP=/tmp/firefox/content/browser
 cd $TMP
	eval "$SED_CMD"	$TMP/browser.xul > $TMP/browser.xul.new; mv $TMP/browser.xul.new $TMP/browser.xul
 cd /tmp/firefox
 zip -qrD0 browser.jar content
 cp browser.jar $DIR
 $ECHO
 exit
 
Personal tools