stylix icon indicating copy to clipboard operation
stylix copied to clipboard

swaync: add addCss option

Open Nerglej opened this issue 1 month ago • 1 comments

Description

Hey!

I would love an option for swaync to enable and disable the opinionated styling that it provides, besides the colors, just like how the waybar module works.

I've already made the code (that I would use), but I couldn't get the development project to run correctly with my config, caused by gnome-shell inputs, and then I ran out of time. Therefore I figured this issue would be appropriate instead of a pull request with untested code. I made a fork with the changes though: https://github.com/Nerglej/stylix

And the changed file:

modules/swaync/hm.nix

{ mkTarget, lib, ... }:
mkTarget {
  name = "swaync";
  humanName = "SwayNC";

  extraOptions = {
    addCss = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "adds fully functional css (otherwise just adds colors and fonts)";
    };
  };

  configElements = [
    (
      { fonts }:
      {
        services.swaync.style = ''
          * {
              font-family: "${fonts.sansSerif.name}";
              font-size: ${toString fonts.sizes.desktop}pt;
          }
        '';
      }
    )
    (
      { colors, cfg }:
      {
        services.swaync.style =
          with colors.withHashtag;
          ''
            @define-color base00 ${base00}; @define-color base01 ${base01};
            @define-color base02 ${base02}; @define-color base03 ${base03};
            @define-color base04 ${base04}; @define-color base05 ${base05};
            @define-color base06 ${base06}; @define-color base07 ${base07};

            @define-color base08 ${base08}; @define-color base09 ${base09};
            @define-color base0A ${base0A}; @define-color base0B ${base0B};
            @define-color base0C ${base0C}; @define-color base0D ${base0D};
            @define-color base0E ${base0E}; @define-color base0F ${base0F};
          ''
          + lib.optionalString cfg.addCss (builtins.readFile ./base.css);
      }
    )
  ];
}

Submission Checklist

  • [x] I assert that this issue is relevant to Stylix
  • [x] I assert that this is not a duplicate of an existing issue

Notify maintainers

@TheMaxMur

Nerglej avatar Oct 29 '25 22:10 Nerglej

feel free to submit a pr for this

0xda157 avatar Nov 07 '25 17:11 0xda157