stylix icon indicating copy to clipboard operation
stylix copied to clipboard

Waybar: only inject colors

Open 3elDU opened this issue 1 year ago • 7 comments

The CSS that is shipped with stylix for waybar is not quite what I want, as I already have written my own styles for it. I only want for the colors to be prepended to the CSS, so that I would be able to use them. It would be great if there would be an ability to only inject color definitions, as it is already being done: https://github.com/danth/stylix/blob/73c6955b4572346cc10f43a459949fe646efbde0/modules/waybar/hm.nix#L36-L41 I'm not sure of what's the best practice to implement such behavior, as I, as the user set the waybar.style property, but stylix also has to write into there somehow. Perhaps a whole different paradigm is required for this, but I'm not the author of stylix to decide.

3elDU avatar Jun 14 '24 15:06 3elDU

Perhaps a whole different paradigm is required for this, but I'm not the author of stylix to decide.

This is a somewhat already acknowledged problem:

the use of extraConfig might cause other potentially related issues. As discussed in #159 (comment), it makes it harder to override options, and as discussed in #388 (comment), it makes it easier to accidentally override Stylix options.

-- https://github.com/danth/stylix/issues/395

trueNAHO avatar Jun 14 '24 15:06 trueNAHO

It seems we're trying to cater to two different groups of users:

  1. Those who expect the CSS to be fully functional without further coding
  2. Those who want to customise the CSS

The best idea that comes to mind is adding a way to partially disable an individual target, so you still get the colors as variables but not applied to anything.

danth avatar Jun 14 '24 21:06 danth

The best idea that comes to mind is adding a way to partially disable an individual target, so you still get the colors as variables but not applied to anything.

That is pretty much the behavior that I would expect, yeah, doing something like

stylix.targets.waybar.addCSS = false;

3elDU avatar Jun 15 '24 14:06 3elDU

The best idea that comes to mind is adding a way to partially disable an individual target, so you still get the colors as variables but not applied to anything.

That is pretty much the behavior that I would expect, yeah, doing something like

stylix.targets.waybar.addCSS = false;

Is this not essentially disabling targets with stylix.targets.<TARGET>.enable = false;?

trueNAHO avatar Jun 16 '24 13:06 trueNAHO

Is this not essentially disabling targets with stylix.targets.<TARGET>.enable = false;?

It would keep the variable definitions part of the CSS, but not the opinionated part which applies those variables to certain areas of the UI.

danth avatar Jun 16 '24 14:06 danth

I suppose you can just disable stylix for waybar and include the @define-color ... lines just the same as the home-manager module would do.

tbaumann avatar Jun 21 '24 12:06 tbaumann

I suppose you can just disable stylix for waybar and include the @define-color ... lines just the same as the home-manager module would do.

That's precisely what I did, for now. https://github.com/3elDU/nixos-config/blob/9894821719037a37be30cfbed296568963075183/home/wm/waybar.nix#L42-L47

3elDU avatar Jun 21 '24 13:06 3elDU