Bspwm: Feature request: Access colors from the X database

Created on 23 Mar 2017  路  10Comments  路  Source: baskerville/bspwm

Hello, can we have this? The advantage is a centralized way of configuring colors, something like this:

https://i3wm.org/docs/userguide.html#xresources
https://github.com/jaagr/polybar/wiki/Configuration

Most helpful comment

Can't this be done through the xrdb utility in the startup script?
I think something like this, albeit more advanced, would be suitable:

xresource() {
  xrdb -query | grep -E "^(bspwm|\*)\.$1" | sed -r "s/^[^:]+:\s+//" | tail -n 1
}

# As an example
bspc config focused_border_color $(xresource focused_border_color)

All 10 comments

Can't this be done through the xrdb utility in the startup script?
I think something like this, albeit more advanced, would be suitable:

xresource() {
  xrdb -query | grep -E "^(bspwm|\*)\.$1" | sed -r "s/^[^:]+:\s+//" | tail -n 1
}

# As an example
bspc config focused_border_color $(xresource focused_border_color)

I was thinking more of using a library the way i3 does, but that's a very nice idea @WhatNodyn, thank you.

@WhatNodyn, maybe you can help this https://github.com/thestinger/termite/issues/263 posting a similar bashrc script ?

@aleprovencio I'm not sure, I might need to dig in a bit more, since I don't think default colors for a terminal can be changed by processes running in it, unlike bspwm. 馃檨

@WhatNodyn , I can turn its background color to red by running printf "%b" "\033]11;#ff0000\007", does this help?

@aleprovencio A lot! I could stumble upon dylanaraps/wal and figure out how those escape sequences work! I'll be sending a Gist on the issue you referred to soon.

thats awesome @WhatNodyn , looking forward to it!

I agree with @thestinger.

@aleprovencio

You probably don't care anymore, but here's a quick script for applying xterm's settings in xresources to termite. This has to be run inside a terminal that already exists, but I imagine a wrapper could launch one and run this immediatley.

#!/bin/bash

# make termite use xresources colors

xrdb -query | grep -i 'xterm\*\(color\|background\|foreground\)' | while read resource_line ; do
  color="$(echo $resource_line | cut -f2 -d\* | tr -d ':' | sed -e 's/foreground/fg/' -e 's/background/bg/')"
  xtermcontrol --$color
done

Yeah, I'm past on this @sagotsky, but thanks for this info.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baskerville picture baskerville  路  3Comments

bcspragu picture bcspragu  路  7Comments

Th3Whit3Wolf picture Th3Whit3Wolf  路  4Comments

Anachron picture Anachron  路  3Comments

evanescente-ondine picture evanescente-ondine  路  6Comments