Is there variables in waybar?
Hi, recently, I was checking if style.css supports variables or not. And it turns out that it doesn't. Here is the code I've written to check it:
:root {
--waybar-border-radius: 2;
}
waybar {
background: #282828;
border-radius: var(--waybar-border-radius)px solid black;
}
The following code didn't even launch waybar in the first place. You might ask when will you need it. Well, imagine this situation, you are writing a configurator and now, asking the user for a border radius they would prefer. How would you write it in css? If you don't have variables it would be hard to do. If you do though you can just prepend the following :root section.
I hope it's already added or it's simple to add. Thanks.
Duplicate: https://github.com/Alexays/Waybar/issues/2112
But I'm assigning border radius, not color.
Ah, I see. In that case I'm not sure it's possible.
What if you do @define-color waybar-border-radius 2;. Does that work?
Ah, I see. In that case I'm not sure it's possible. What if you do
@define-color waybar-border-radius 2;. Does that work?
Doesn't work for me
[2024-05-03 21:31:56.274] [error] style.css:11:38'1px' is not a valid color name
Edit:
I use NixOS (home-manager-managed) so variables is as simple as using let..in bindings
https://github.com/jfvillablanca/nixos-dot/blob/b74a1af7722e81a0bf40b348a4f501e9d5b40db6/homeModules/waybar/default.nix#L169C1-L191C51
but for a more native solution, I have no idea
Why is this issue closed? It should be fixed.