July 31, 2017 · linux config

Custom Qutebrowser keybindings

2018-01-22 update: Qutebrowser has changed its configuration methods. These all still work, but must be updated to use the new config syntax. (see my dotfiles for updates ;) )

Qutebrowser is an epic "keyboard-driven, vim-like browser based on PyQt5".

It has extremely flexible support for quick/easy key bindings. Aside from the defaults that ship with it, you can assign pretty much any key combination to any combination of commands or scripts. Anyway, here are some interesting custom keybindings I have in my keys.conf that may or may not be interesting/inspiring.

Switching useragent

set network user-agent ""

set network user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7'

Useful for if you want to quickly switch the useragent. I don't use it very often anymore now that Qutebrowser uses WebEngine as the backend, but was very useful in situations like:

Viewing videos in a video player

This is pretty much standard now, and there are published userscripts that do this with extra fanciness. This version is probably the quickest/simplest method.

spawn nohup mpv {url}

hint links spawn nohup mpv {hint-url}

x to open the current Youtube or other video page in mpv, or ;x to start
open a link via hints in mpv. nohup is used to it keeps playing even if you
close the browser.

Zotero bookmarklet

jseval javascript:var d=document,s=d.createElement('script');s.src='https://www.zotero.org/bookmarklet/loader.js';(d.body?d.body:d.documentElement).appendChild(s);void(0);

Now when you type ,z in normal mode, it runs the
Zotero bookmarklet script to save the current page to
your Zotero account.

This same technique can be used for any js bookmarklets. (Note that currently
bookmarklets can't be bookmarked like other links - relevant

Internet Archive

Ever follow a link to a url only to receive a 404 error?
With the following keybindings, you can simply type wa to open the url on the
Internet Archive. (or ;wa for a hint-links version)

open https://web.archive.org/web/{url}

hint links fill :open -t https://web.archive.org/web/{hint-url}

Final notes

This is only scraping the surface of what is possible! There are many many other
things you could do with simple keybindings, and this doesn't even cover
userscripts where you can script the browser in any programming language!

If you have any interesting ideas of your own, please comment here or ping me on