You are not logged in.

#1 2025-03-24 18:50:38

bowlin
Member
Registered: 2025-02-27
Posts: 60

[solved] How to get dmenu to read pywal colors from Xresources?

Been pondering this for a while after I patched dmenu. I'm under the assumption that it should just work.

Running:

wal -i /path/to/image

Doesn't change dmenu's colors. Also tried running xrdb -merge on both .Xresources and .cache/wal/colors.Xresources.

After running the merge I ran:

xrdb -query | grep -i color

And it's showing proper output, so I'm guessing it should work? Any help highly appreciated, first time properly using Xresources.

Last edited by bowlin (2025-03-26 08:45:37)

Offline

#2 2025-03-24 20:49:04

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,774

Re: [solved] How to get dmenu to read pywal colors from Xresources?

https://tools.suckless.org/dmenu/patches/
Which patch(es) and are color resources otherwise read when not written by pywal?

Offline

#3 2025-03-25 06:24:40

bowlin
Member
Registered: 2025-02-27
Posts: 60

Re: [solved] How to get dmenu to read pywal colors from Xresources?

Currently have center and border patches (and Xresources) applied, removed the alpha patch due to it colliding with the Xresources patch.

Set this in my .Xresources: *dmenu.border:  #3c3836 and ran xrdb -merge .Xresources. Did xrdb -query | grep dmenu and it showed it.

For clarification this is my config.def.h, and at the same time my config.h: https://bpa.st/TIKQ

--- Edit ---

Woops, turns out it wasn't the correct syntax. Changed it to:

*dmenu.background : #3c3836
*dmenu.foreground : #3c3836
*dmenu.selbackground : #3c3836
*dmenu.selforeground : #3c3836

And now it changes it. So it comes down to pywal.

Last edited by bowlin (2025-03-25 06:31:50)

Offline

#4 2025-03-25 07:31:48

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,774

Re: [solved] How to get dmenu to read pywal colors from Xresources?

I meant which patch you're using to mainpulate the colors, https://github.com/dylanaraps/pywal/blo … al-dmenu.h looks more like https://tools.suckless.org/dmenu/patches/xtheme/

Offline

#5 2025-03-25 09:42:53

bowlin
Member
Registered: 2025-02-27
Posts: 60

Re: [solved] How to get dmenu to read pywal colors from Xresources?

Offline

#6 2025-03-25 15:51:31

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,774

Re: [solved] How to get dmenu to read pywal colors from Xresources?

Did you test the xtheme patch?
Cause it doesn't look like pywal writes xrdb for dmenu at all?

Offline

#7 2025-03-25 17:26:49

bowlin
Member
Registered: 2025-02-27
Posts: 60

Re: [solved] How to get dmenu to read pywal colors from Xresources?

Will give it a go and report back!

Was confused since the xresources patch for st worked. Although it was the one with signal-reloading.

-- Edit --

But pywal does have a file: .cache/wal/colors.Xresources

And the main motivator for all this is that I don't have to recompile it every time I change the colorscheme.

Last edited by bowlin (2025-03-25 17:52:16)

Offline

#8 2025-03-25 20:57:28

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,774

Re: [solved] How to get dmenu to read pywal colors from Xresources?

But pywal does have a file: .cache/wal/colors.Xresources

And does it set the dmenu resources there?
What does the file look like?

https://man.archlinux.org/man/extra/dmenu/dmenu.1.en supports setting colors via the commandline, if you can extract the relevant ones from somewhere (incl. "xrdb -q") you can set them this way on invocation.

Offline

#9 2025-03-26 06:57:38

bowlin
Member
Registered: 2025-02-27
Posts: 60

Re: [solved] How to get dmenu to read pywal colors from Xresources?

This is the file: https://bpa.st/3SSA
It isn't a big deal if I have to compile dmenu alone though. Just thought that I'd work just like that tongue I know:

wal -i $image -o ~/.Xresources

Would write straight to .Xresources, but it says no permissions when I do it and I don't think that is the correct way to do it anyways. Looking at the other file: https://bpa.st/42SA (.cache/wal/colors-wal-dmenu.h), it definitely looks different than the Xresources one.
That one works and is indeed referenced in github, just deleting the color array and adding an include line makes it work. But that again, requires me to recompile it everytime.

Offline

#10 2025-03-26 07:25:20

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,774

Re: [solved] How to get dmenu to read pywal colors from Xresources?

read DMENU_NB DMENU_NF DMENU_SB DMENU_SF < <(awk -F '"' '/SchemeNorm/{print $2" "$4}; /SchemeSel/{print $2" " $4}' ~/.cache/wal/colors-wal-dmenu.h)
dmenu -nb $DMENU_NB -nf $DMENU_NF …

Offline

#11 2025-03-26 08:45:13

bowlin
Member
Registered: 2025-02-27
Posts: 60

Re: [solved] How to get dmenu to read pywal colors from Xresources?

Turns out I made it more complicated than it should've been tongue I got kinda fixated on the whole notion of using Xresources, when I could've just used an alias... :

#!/bin/sh

# Import the colors
. "${HOME}/.cache/wal/colors.sh"

dmenu_run -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15"

Thanks anyways!

Offline

Board footer

Powered by FluxBB