« Compartmentalizing Hugo Settings
  
AsciiDoc Tips and Fragments »

qutebrowser Key Bindings
Updated  2022-August-5

Page contents

News

2022-January-24  Published this evolving⁠[1] article.

 

Prerequisites

Built-in key bindings

To view qutebrowser’s built-in key bindings, view line 2122 and below in Infinite Ink’s qutebrowser’s Template config.py. The following is the beginning of that part of the default config.py.

2121## Bindings for normal mode
2122config.bind("'", 'mode-enter jump_mark')
2123config.bind('+', 'zoom-in')
2124config.bind('-', 'zoom-out')
2125

 

The two emphasized lines above make it possible to use the + and -⁠ keys to zoom in and zoom out on a web page.

 

User-defined key bindings

If you create a key binding, you may want to start it with a comma (,) because @The-⁠Compiler (Florian Bruhin), qutebrowser’s main developer, has said that default key bindings will never start with a comma.

💡

If you start most of your user-defined key bindings with a comma (,), then typing , in normal mode will display a keyhint widget  that lists key bindings that start with ,. This is useful if you don’t remember your user-defined bindings.🤔

 

Examples of user-defined key bindings

Zooming

Because I’m used to using Ctrl+= and Ctrl+- to zoom in and zoom out on a web page, I put the following in my config.py.

config.bind('<Ctrl-=>', 'zoom-in')
config.bind('<Ctrl-->', 'zoom-out')

 

Adblock update

Because I often forget to run :adblock-⁠update, I put the following ,au binding in my config.py.

config.bind(',au', 'set-cmd-text :adblock-update')

Now, when I type , in normal mode this shows up near the top of the keyhint widget and reminds me to periodically run this.

 

Launching userscripts

Infinite Ink’s qutebrowser Userscripts on Windows includes the following key bindings, each of which launches a userscript.

config.bind(',qenv', 'spawn -u -o "qb-env.cmd"')
config.bind(',t', 'spawn -u tumblelog-wrapper.cmd')

 

Killing popups and other floating elements

config.bind(',kp', 'jseval (function () { '+
'  var i, elements = document.querySelectorAll("body *");'+
''+
'  for (i = 0; i < elements.length; i++) {'+
'    var pos = getComputedStyle(elements[i]).position;'+
'    if (pos === "fixed" || pos == "sticky") {'+
'      elements[i].parentNode.removeChild(elements[i]);'+
'    }'+
'  }'+
'})();');

 

If you put this in your config.py, you can type ,kp in normal mode to kill popups on qutebrowser’s current web page.

 

Tips

:bind command

To view all key bindings, run the following within qutebrowser.

:bind

This command lists both built-in and user-defined key bindings.

 

:unbind command

To unbind a key binding, for example Ctrl+t, during the current qutebrowser session, run something like this:

:unbind <Ctrl-t>

To permanently unbind a key binding, put something like this in your config.py:

config.unbind('<ctrl-t>')

 

💡
I unbind Ctrl+t because I’m training myself to use Shift+o to open a URL in a new tab (rather than using Ctrl+t followed by o, which is what I used to do).

 

See also

Endnote


1. Many Infinite Ink articles, including this one, are evergreen and regularly updated.

Comments and questions 📝 🤔 👎 👍

Your public comment or question might immediately improve this page or help me to (eventually) improve this page.