Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow variable substitution in --color-muted #80

Open
rtreccani opened this issue Jan 7, 2023 · 4 comments
Open

Allow variable substitution in --color-muted #80

rtreccani opened this issue Jan 7, 2023 · 4 comments

Comments

@rtreccani
Copy link

rtreccani commented Jan 7, 2023

I use wal to theme my system, and for most modules I could use something like
format-muted = ${colors.disabled} to make the module highlight red when muted, or use
--color-muted ${colors.disabled} in my call to the pulseaudio-control bash script, but I get /bin/bash line 1: bad substitution when I do that.
Is there an undocumented way to change the color of the module when muted, or some way to correctly escape the color such that it can be read?

@marioortizmanero
Copy link
Owner

I think ${colors.disabled} isn't a valid variable in bash. I also use wal, and in .cache/wal/colors.sh, they're declared as color0 and such. Is that what you actually want to use?

@rtreccani
Copy link
Author

I'm not sure if that's the 'canonical' way that polybar does it, but yeah in my polybar config, i have a block such as

[colors]
urgent = ${xrdb:color4}
disabled = ${xrdb:color5}
primary = ${xrdb:color6}
foreground = ${xrdb:color7}

which just renames the xrdb variables to something more palatable, and then when i want to use it, for example

[module/xworkspaces]
label-active-background = ${colors.background}
label-active-underline= ${colors.disabled}

this works for the polybar modules i'm using so far, so maybe the best option would be
format-muted = ${colors.disabled}being supported, as it doesn't rely on bash expanding the variable.

Thanks for the quick response and the amazing module btw :)

@marioortizmanero
Copy link
Owner

marioortizmanero commented Jan 9, 2023

That won't work because polybar variables can't be set as part of another string. If you use a variable, the entire value has to be the variable, not command ${variable}, for example. I also ran into this issue, and not sure if I ended up resolving it, because AFAIK in script modules you can't really have these format-muted-like custom fields. Maybe you could create a wrapper that reads from the cache pywal script and executes this with the proper variable expanded.

@rtreccani
Copy link
Author

I'm just trying to achieve something similiar to, for example, the default PulseAudio module, see https://github.com/rtreccani/dotfiles/blob/newlap/polybar/config#L168. Forget using Pywal, is it possible to statically set the colour of unmuted vs muted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants