ankursinha.in/blog

neuroscience/fedora/musings

Wed 21 June 2017

Giving Qutebrowser a go - a fantastic keyboard-focused browser

Posted by ankur in Tech (1005 words, approximately a 5 minute read)


  • Share this post:

A screenshot showing hints in Qutebrowser on the Qutebrowser website

Years ago, I was introduce to touch typing. I knew immediately that it was a skill I must learn. I remember spending hours playing with gtypist trying to improve my typing efficiency. I'm not too bad nowadays. I can mostly type without looking at the keyboard at all, and with few errors.

I've always loved using the command line. In fact, I maintain that new programmers should start at the command line and only move to IDEs once they've learned exactly what's being done under the hood. I use the terminal as much as conveniently possible - music via ncmpcpp, IRC on irssi (there are Gitter and Slack gateways to IRC too), taskwarrior to organise my TODOs, all my writing in VIM (programming and otherwise), for example. Byobu makes it really easy.

The one effect sticking to the command line so much has had on me is that I've developed a slight aversion to the mouse/touchpad. I now feel mildly annoyed if I must move my fingers off the home-row to do something. I must use the touchpad to check my mail/calendar on Evolution, for example, but this doesn't annoy me too much because I usually check these when I've taken a break from programming (or my code is compiling). It's really on Firefox that the constant switching between keyboard and mouse used to be a real downer.

Being a VIM user, I did the expected - went looking to see if there was a way to use VIM style key-mappings on Firefox. There are multiple add-ons that permit this with different feature sets - vimperator, pentadactyl, vimium, vimFX are a few examples. Now, the different features these provide cater to different people's requirements. I went for pentadactly. Not only does it permit VIM style key mappings and navigation, it also provides a vim style command line that is incredibly handy. I've used it for years now. The issue that has troubled pentadactyl for some time now is constant breakage - it tends to break each time the Firefox addon API is updated. Recently, I read that some major changes in the API will make pentadactly pretty much unusable in the near future. This made me go looking for a more stable alternative. I tried one or two others - vimium for example, but somehow, I find vimium too simple.

So, I dug further and ran into Vimb and Qutebrowser. They're both "vim like browsers" i.e., they're designed for more advanced users and they provide VIM like key-mappings and modes. I gave vimb a short try, but Qutebrowser really impressed me a lot more.

Qutebrowser

The best thing about Qutebrowser is that it's actively maintained. I even hopped on to the IRC channel earlier today to get some help. The latest version is in Fedora already, so you can simply go sudo dnf install qutebrowser to give it a whirl. I wanted to test out the latest codebase, so I quickly set up a copr repository that you can use too. I'm tinkering with FlatPak to try and build one too, so that it becomes even easier to install, but I'm still figuring out how FlatPaks are built.

A screenshot showing hints in Qutebrowser

The screenshot shows "hinting" which is how one opens links. You press "f" and the various links in the page get labelled. Simply type the label of the link you want to visit. There's also "advanced hinting" which lets you do things like open links in a background tab, or in a new tab, or save (yank) a link URL.

A screenshot showing the command mode in Qutebrowser

This one shows the command mode - everything can be done here, including configuration of the browser or browsing related tasks.

A few tips

I did a few things to get started. First, I wanted to use the new "webengine" backend. This requires the installation of two packages: sudo dnf install python3-pyopengl python3-qt5-webengine, and then creating a new file in ~/.local/share/applications/qutebrowser.desktop with the following contents:

[Desktop Entry]
Name=qutebrowser
GenericName=Web Browser
Icon=qutebrowser
Type=Application
Categories=Network;WebBrowser;
Exec=qutebrowser --backend webengine %u
Terminal=false
StartupNotify=false
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
Keywords=Browser
X-Desktop-File-Install-Version=0.23

This new file simply ensures that picking Qutebrowser from the activities menu will run the new backend. Without this, one would have to launch it from the terminal each time.

Next, I configured it a bit to my liking - still very limited, but it's a start. The configuration file for Qutebrowser is at ~/.config/qutebrowser/qutebrowser.conf. There's so much one can modify here. I've only set up a few search engines and updated the default to Google. To do this, one needs to modify the [searchengines] section in the file:

DEFAULT = https://google.com/search?hl=en-GB&q={}
duckduckgo = https://duckduckgo.com/?q={}
github = https://github.com/search?q={}
google-scholar = https://scholar.google.co.uk/scholar?hl=en&q={}

I also enable save-session - just set it to true. There are a few other tweaks, such as updating the startpage to http://start.fedoraproject.org. There's even a built in ad-blocker that one can configure.

To get flash working, one needs to also install the ppapi bits. Assuming one already has the flash plugin repository installed, sudo dnf install flash-player-ppapi does this. I haven't gotten Netflix to work yet - it requries some Silverlight thingy. I can always run Chrome or FF for that one rare purpose anyway.

There are, obviously a few limitations in the current Qutebrowser version. The most noticeable one is probably the lack of a sync service similar to ones Firefox and Chrome provide. Google does tell me something about using syncthing but I haven't gotten down to this yet. While it would be nice to have, it isn't quite that necessary. There isn't a password manager either. There are plans to develop a plug-in system in the pipeline to implement such features already, though. (userscripts seem to provide some additional functionality too.)

Anyway, it's a great, quick, and lean browser if you're a VIM addict like me, so give it a go? If you have some cycles and are intersted in some hacking, get in touch with the devs over Github too. If not, please do at least file bugs if you see them.

Here's a quickstart to quickly get up and running with. Oh, and yeah, the mouse/touchpad works in the browser too!


  • Share this post:

Comments