swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.65k stars 1.11k forks source link

Colors from .Xdefaults #5796

Closed pblgomez closed 3 years ago

pblgomez commented 3 years ago

In i3wm you can read the color values from .Xresources like this: set_from_resource $bg i3wm.color0 and then read it like $bg

It doesn't seem to work in sway

emersion commented 3 years ago

.Xresources is purely an X11 thing, Sway won't support it.

andi242 commented 3 years ago

@pblgomez if you wanted .Xresources colors you could just execute something like this: xrdb -query | grep color | sed 's/*/set $/g' | sed 's/://g' > <path/to/file>/colors.conf this basically translates .Xresources syntax to sway syntax, given the standard *color syntax is in place or you replace the seds with a pattern that fits your needs.

add this to your sway config file: include <path/to/file>/colors.conf

you may want to wrap this into a startup script to regenerate colors when sway ist started.

pblgomez commented 3 years ago

I have scripts to change colors for multiple apps, but in X I used to read them all from one central place like Xresources. Now I have to use sed for every app. In the Arch wiki I read something about wayland using Xdefaults but maybe is not.