Middle-click in Firefox
It's a very common thing in Linux, but coming from Windows this was new to me: select something, and the mere fact that it was selected/highlighted is enough to make it available for "paste" using the middle-click. It's a common thing that should work pretty much everywhere in Linux it seems, and once you're used to it, it can be quite useful.
Firefox, my browser of choice for a few years now, naturally supports this.
However, its behavior in that matter is regulated through a couple of options,
and their default values aren't the same on Windows and Linux. On linux, both
middlemouse.paste
and middlemouse.contentLoadURL
default to true
(while on
Windows both default to false
).
The second one is especially nice, because it means that if you do have an URL ready to be middle-pasted, a middle click anywhere on the current page will automatically open said URL. Pretty nice, however there were a couple of things I wanted:
- I wanted said URL to be opened in a new tab
- I thought it would be nice if, when I have something other than a URL, instead of doing nothing it would start a search
Middle Search
The second issue was solved thanks to a nice FF extension, Middle
Search by Ivo Danihelka. This extension does exactly that: if the text
is not an URL (does not start with http(s)://
or ftp://
) then it will be
used as keyword in a new search, done using your default search engine.
The only little problem I had with it, is that - much like the native handling of the URL - it happens in the current tab, when I'd like it to open a new tab instead.
Fortunately this FF extension is made of a little JavaScript, and could be easily modified. Even better, I could also make it take care of the case when an URL is present, instead of letting Firefox deal with it, and therefore open it in a new tab as well.
If you also want a version that opens everything (URL and searches) in a new tab, the modified source code is available on this BitBucket repository. You can also find an XPI file of said version.
Edit 2011-12-21: updated download link to v0.8.1.1; just a bump in version numbers to support Firefox 9.
Selection in the address bar
One last thing about this whole issue, and again a difference in how Firefox behaves (by default) depending on your OS. On Windows, a click in the address bar will automatically select it all. Not so in Linux, which isn't a bad idea considering how the whole middle-paste thing works.
However, on Windows when you double-click somewhere on the URL (in the address bar), only part of it gets selected. It works on a "word" basis, which makes it pretty easy to quickly select only a part of the URL, for example only the domain name, or the file name. But in Linux, the double-click will select the whole thing!
It annoyed me, but it doesn't anymore since, once again, this is only one
setting that can be easily changed. Open about:config
and search for
browser.urlbar.doubleClickSelectsAll
What it does is pretty obvious, and it
does default to false
on Windows, but true
on Linux. Once adjusted, the
double-click will work again on a "per-word" basis, and you will still be able
to select the whole URL with a triple-click.