Introduction: Customizing Multitouch Gestures in Firefox
For anyone who does not use gestures already, they're extremely helpful. Multitouch gestures allow you to input a physical motion on the trackpad in place of a keyboard or virtual menu command on your computer. In time, the correlation between physical motion and virtual reaction becomes second nature, and allows for very quick computing. I'll give my recommendations and current set up, but the time-saving possibilities and shortcuts are endless.
The new Firefox has some gestures to start with. You can:
- Swipe Left: Go back in history
- Swipe Right: Go forward in history
- Swipe Up: Go to the top of the page
- Swipe Down: Go to the end of the page
I will also show how to do some other modifications you can make in the sensitivity and functionality department of the twist and pinch gestures.
Though the instructable was introduced following the release of Firefox 4 and it's increased support for gestures, it still is applicable to all of the versions since.
Step 1: Types of Gestures
- browser.gesture.twist.right - twist/rotate right
- browser.gesture.twist.left - twist/rotate left
- browser.gesture.pinch.in - pinch in
- browser.gesture.pinch.out - pinch out
- browser.gesture.pinch.in.shift - pinch in + shift
- browser.gesture.pinch.out.shift - pinch out + shift
- browser.gesture.swipe.up - swipe up
- browser.gesture.swipe.down - swipe down
- browser.gesture.swipe.left - swipe left
- browser.gesture.swipe.right - swipe right
When pairing your gestures to commands, consider their function. If you want to switch to the tab on your right, it doesn't make any sense to use swipe up or pinch in as your gesture to get there. If you set it up comfortably, it will feel natural and require little or no explanation to a new user on your computer.
Step 2: Types of Commands
all of the possible commands to my knowledge are located Here and here, but many of them seem like a waste to have taking up one of your precious multitouch gestures.
Some of the most useful ones are:
- cmd_newNavigator - new Firefox window
- cmd_handleBackspace - back
- cmd_newNavigatorTab - new tab
- Browser:OpenFile - brings up open file dialogue
- Browser:SavePage - opens save file prompt
- Browser:SendLink - sends link to default email client
- cmd_print opens - print dialogue
- cmd_printPreview - opens print preview dialogue
- cmd_close - closes tab
- cmd_closeWindow - closes window with all tabs
- cmd_quitApplication -quits Firefox
- View:FullScreen - toggles fullscreen mode
- cmd_find - opens find dialogue (cmd-f)
- cmd_findAgain - runs previous find on page
- Browser:AddBookmarkAs - adds bookmark and opens interface to add details
- Browser:Home - Goes to home
- Browser:BackOrBackDuplicate - goes back
- Browser:ForwardOrForwardDuplicate - goes forward
- Browser:Stop - stops loading of page
- Browser:Reload - reloads page
- Browser:NextTab - switches to your tab on the right
- Browser:PrevTab - switches to your tab on the left
- cmd_scrollBottom - scrolls to the bottom of the document
- cmd_scrollTop - scrolls to the top of the document
- cmd_fullZoomReduce - zooms out
- cmd_fullZoomEnlarge - zooms in
- Browser:OpenLocation - selects address bar (same as cmd L)
- History:UndoCloseTab - opens previously closed tab
If you have a very specific command you're looking for, and it's not in this list, check the links at the top. If it's not there, do some research into what the keyboard shortcut or menu selection equivalent is referred to in the source code.
Step 3: Setup
type "about:config" into your address bar. It will prompt you with a warning, read it, and click on the "I'll be careful, I promise!" button. Don't touch anything in here, it's like the china cabinet you had in your dining room as a kid. Just go and get the Christmas plates your mom asked for as quickly and quietly as you can without touching or breaking anything else.
Select the filter bar at the top (NOT the address bar) and search "gesture" to bring up all of the actions and commands dealing with gestures.
Sort by type at the column headers. This will group all of the string preferences together, they are the ones you can designate a command to.
You'll notice a preference called "browser.gesture.tap" which represents a single tap/click. It is set to reset the zoom so that, for example, your 400% zoom setting for that size 6 font news site doesn't continue on into an ad you click on that site informing you that you can "Last 2x As Long!" (note: this does not mean you can last 800% longer). If you stay on the same website though, it is my experience that the zoom level stays consistent with your adjustments. My explanation for this feature is completely sourced from personal use though, and may not be correct.You could change this, so that Firefox does something every time you click (perhaps a prank?), but I'm not really sure how it would be useful.
To make the adjustments, simply identify the gesture that you want to adjust, double click it under the "value" column, and paste in the desired command from the list. It is important that you keep the commands the exact same; they only work with the correct, case sensitive version.
I have attached images of the successive pages and screens you should be encountering in order to get to the right place to change your settings. The text is very small in the default window, so click the small "i" in the top left hand corner and go to the original file in order to get a more detailed picture. I should mention that the last picture is not what your screen will look like, but it is what my screen looks like after all of it's modification.
Please note that any customizations and modifications you make to the gesture settings here will not transfer to any other applications on your computer. If you want to customize multitouch gestures in other applications, you need to use an application like Multiclutch.
Step 4: Controlling the Twist and Pinch Threshold
Besides the string preferences, there are also integer and boolean preferences. You can not change the functionality here by adding a command, but you can change the minutia of gestures themselves using these preferences.
Integer preferences allow you to change a number. "browser.gesture.twist.threshold" is the preference for the sensitivity of your twist command. The default for this is 25. The 25 represents a value for how far your twist gesture must go before Firefox recognizes it as a twist.
When you put two fingers on the trackpad, Firefox recognizes this, but it isn't until your gesture has passed the set threshold that Firefox calls it a legitimate twist. most of the time if you are not able to have it recognize your twist command, it is simply because you haven't twisted enough for Firefox to distinguish between an accident and intentional twist. This means that the integer value is too high for your unique interpretation of the twist gesture.Adversely, you may find Firefox incorrectly recognizing twist commands being inputted, which means the integer value is too low for your personal way of gesturing.
If you want to make the twist command easier for Firefox to recognize, lower the integer value to something like 10 or 15. This will help a lot.
If you want to make twisting harder to do, raise the value to around 40 or 50. A value like this makes it extremely hard to accidentally perform a twist.
If you'd like to disable the twist, but keep your precious commands set, you could set the twist value to some arbitrary massive number, like 1000. This would make it quite a challenge to get a twist recognized in firefox. It would literally take walking around the computer with your fingers on the trackpad twisting the whole time for several revolutions to get one to register. A competition where people set their browser.gesture.twist.threshold value to massive numbers and get one recognized by Firefox would be entertaining.
The pinch is the exact same as the twist in terms of the interpretation of it's integer value and the problems associated with it, but the value starts much higher. The default is 150.
For an easier time pinching, set the value to around 60-80. I personally am shocked that the value's default is not somewhere in this range.
To make pinching harder, set the value to around 180-200. This is like pinching someone that is really, really fat.
To disable pinching, set the number to a "Jabba the Hutt" sized pinch, say 1000 or so, which will make pinching impossible.
Another prank might be to set this value as 1. Just try it.
Step 5: Adjusting the Twist and Pinch Latch
There are three boolean preferences you can change: browser.gesture.twist.latched, browser.gesture.pinch.latched, and gestures.enable_single_finger_input. I can't figure out exactly what the last one does, but from my experimentation it does nothing.
To adjust these settings, double click on their value (either true or false) under the value column. It will change when your double click is recognized.
For the latches, a setting of false allows you to perform multiple commands from a single input of the gesture. For instance, if you have twist set to back, you can twist and hold your fingers in the end position, and Firefox will continue to go back, one page after another, until you release your hand from the twisted position.
When a latch is set to true, it means that when you perform one gesture, you get one output. To expand on the example before, a twist latch set to true would allow you only one page back for every time you perform the twist gesture.
please note that my explanations are from experience mainly, and may not be precise; feel free to correct me!
Step 6: Suggested Settings
My commands are:
- Twist right/left - forward/back
- Pinch in/out - zoom out/in (this seems contradictory but in reality it's what you'd expect)
- Swipe up - open new tab
- Swipe down - close current tab
- Swipe left/right - go to previous/next tab
- Pinch out + shift - undo close tab
- Twist threshold - 13
- Pinch threshold - 80
- Twist latched - false
- Pinch latched - false
The only downside is that while many of the settings are very intuitive, the presence of multitouch to someone who has never used it before can be very confusing if they are not aware of the gestures they are inadvertently making.