danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
902 stars 105 forks source link

Waybar: only inject colors #429

Open 3elDU opened 2 weeks ago

3elDU commented 2 weeks ago

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.

trueNAHO commented 2 weeks ago

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

danth commented 2 weeks ago

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.

3elDU commented 2 weeks ago

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;
trueNAHO commented 2 weeks ago

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;?

danth commented 2 weeks ago

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.

tbaumann commented 1 week ago

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.

3elDU commented 1 week ago

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