Qutebrowser: Source Colors from Xresources Feature Request

Created on 14 Oct 2017  路  3Comments  路  Source: qutebrowser/qutebrowser

This feature request maybe a little out there, not sure...

The i3wm for example lets you source colors for it windows, fonts and bar from Xresources with the following command:

set_from_resource $fg i3wm.color5

Maybe there is way also to implement this in the qutebrowser config so that we can source a variable for the colors. For example

tabs.fg.selected.odd = $fg

Then qutebrowser sources those colors while its loading

Most helpful comment

Something like this can be used in your config.py:

def read_xresources(prefix):
    props = {}
    x = subprocess.run(['xrdb', '-query'], stdout=subprocess.PIPE)
    lines = x.stdout.decode().split('\n')
    for line in filter(lambda l : l.startswith(prefix), lines):
        prop, _, value = line.partition(':\t')
        props[prop] = value
    return props

xresources = read_xresources('*')
c.colors.statusbar.normal.bg = xresources['*background']

I got the read_xresources from someone on IRC, can't remember who (sorry :P).

All 3 comments

With the new configuration in v1.0, you can do that yourself in a config.py - I think @pkillnine had something like that?

Something like this can be used in your config.py:

def read_xresources(prefix):
    props = {}
    x = subprocess.run(['xrdb', '-query'], stdout=subprocess.PIPE)
    lines = x.stdout.decode().split('\n')
    for line in filter(lambda l : l.startswith(prefix), lines):
        prop, _, value = line.partition(':\t')
        props[prop] = value
    return props

xresources = read_xresources('*')
c.colors.statusbar.normal.bg = xresources['*background']

I got the read_xresources from someone on IRC, can't remember who (sorry :P).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

orangecms picture orangecms  路  3Comments

jmburgos picture jmburgos  路  4Comments

Ram-Z picture Ram-Z  路  4Comments

The-Compiler picture The-Compiler  路  4Comments

Chinggis6 picture Chinggis6  路  4Comments