Spandan
Spandan Blog Author, ECE Student, Institute of Engineering & Management, Kolkata

Qutebrowser - Minimal and Vimmed!


Qutebrowser - Minimal and Vimmed!

Being someone who strives to have a steamlined, minimal setup and someone who doesn’t like to go and take his/her hands off the keyboard and place it on the mouse (too much work XD), I had been pretty bugged that I did not have a minimal browser to be used in my daily workflow ie. not just for bragging rights. I had surf by suckless but somehow pages with too much graphics were not as responsive as Firefox (Maybe I am yet to set it up right).

Using Vim in my everyday workflow has further spoiled me. I love Vim keybindings. I love them so much that even when I set up Emacs, (I love org-mode), the first thing I set up is the EVIL key bindings. First thing that fascinated me about qutebrowser : These beautiful keybindings. I have also heard of VimB but I am yet to find a reason to move to it. So, make sure you are in INSERT mode while typing. Here is the official keybinding cheetsheet from their Github page.

QuteCheetSheet

As you start using these keybindings pop-ups with completion suggestions come up.

Pop UP

There is an elaborate configuration process which is mentioned in detail in their doc. However , here is a quick setup to get you started. Once qutebrowser is installed on your Linux system, go to your config folder

1
$HOME/.config/qutebrowser

If that folder does not exist, create it. In that folder we shall use a slightly modified autoconfig.yml and a config.py to set you up with my working configuration.

The autoconfig.yml file is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
config_version: 2
settings:
  aliases:
    global:
      q: close
      qa: quit
      w: session-save
      wq: quit --save
      wqa: quit --save
  bindings.commands:
    global:
      normal:
        ',v': spawn mpv -vo=gpu {url}
        u: null

Or open up your browser and type

1
:config-set

The config.py file is as follows. I have skipped several custom set keybindings so as to not affect your workflow or your use of the defaults. All except the mpv spawner ( Simply cause I love using it too much).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def bind_header(url_wild_card, alt_header='Mozilla/5.0 ({os_info}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'):
    config.set('content.headers.user_agent', alt_header, url_wild_card)


config.load_autoconfig()

bind_header('https://web.whatsapp.com')
bind_header('https://accounts.google.com/*')
bind_header('https://*.slack.com/*')
bind_header('https://docs.google.com/*')
bind_header('https://www.netflix.com/*')
bind_header('https://www.primevideo.com/*')

# Type: Bool
config.set('content.images', True, 'chrome-devtools://*')

# Load images automatically in web pages.
# Type: Bool
config.set('content.images', True, 'devtools://*')

# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome-devtools://*')

# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'devtools://*')

# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome://*/*')

# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'qute://*/*')

config.bind(',v', 'spawn mpv -vo=gpu {url}')

Some websites like whatsapp web and NetFlix respond better to a known header and hence I have set the browser header for these. I omitted out my colorscheme as the code would be too long to discuss. But an autoamated colorsheme may be setup using the qutebrowser base16 configurations as available this repository.

Let’s end this by looking at two cool features:

  1. I want to play an youtube video while doing something else. So, I can spawn it onto mpv to play on my gpu using the keybinding ,v and this does consume lesser Ram and power than playing it on the browser.

MPV-SPAWN

  1. Suppose I want to download the current page as an html file. :download or gd

download

It is to be noted that you may notice that hardware acceleration for decoding and several others have been disabled or are being software rendered. You may or may not like this. If you do not like this and would like hardware accelerated decoding,rasterization etc, run qutebrowser using the following command.

1
qutebrowser --qt-flag ignore-gpu-blacklist --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag num-raster-threads=4

So go on, download install and enjoy.