11.stylix/modules/sway/hm.nix
Jalil David Salamé Messina 7682713f6a
stylix: add 'stylix.enable' option (#244)
Add a 'stylix.enable' option to enable or disable all Stylix modules in
order to resolve issues similar to [2].

To align with the default 'lib.mkEnableOption' [1] behavior,
'stylix.enable' defaults to 'false'.

BREAKING CHANGE: Stylix is disabled by default. To enable it, use:

    stylix.enable = true;

[1]: https://github.com/NixOS/nixpkgs/blob/23.11/lib/options.nix#L91-L105
[2]: https://github.com/danth/stylix/issues/216

Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com>
Co-authored-by: Jalil David Salamé Messina <jalil.salame@gmail.com>
Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
2024-06-10 11:52:47 +02:00

101 lines
2.5 KiB
Nix

{ config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
let
text = base05;
urgent = base08;
focused = base0D;
unfocused = base03;
fonts = {
names = [ config.stylix.fonts.sansSerif.name ];
size = config.stylix.fonts.sizes.desktop + 0.0;
};
in {
options.stylix.targets.sway.enable =
config.lib.stylix.mkEnableTarget "Sway" true;
config = lib.mkMerge [
(lib.mkIf (config.stylix.enable && config.stylix.targets.sway.enable) {
wayland.windowManager.sway.config = {
inherit fonts;
colors = let
background = base00;
indicator = base0B;
in {
inherit background;
urgent = {
inherit background indicator text;
border = urgent;
childBorder = urgent;
};
focused = {
inherit background indicator text;
border = focused;
childBorder = focused;
};
focusedInactive = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
unfocused = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
placeholder = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
};
output."*".bg = "${config.stylix.image} ${config.stylix.imageScalingMode}";
seat."*" = {
xcursor_theme = "${config.stylix.cursor.name} ${toString config.stylix.cursor.size}";
};
};
})
{
# Merge this with your bar configuration using //config.lib.stylix.sway.bar
lib.stylix.sway.bar = {
inherit fonts;
colors = let
background = base01;
border = background;
in {
inherit background;
statusline = text;
separator = base03;
focusedWorkspace = {
inherit text border;
background = focused;
};
activeWorkspace = {
inherit text border;
background = unfocused;
};
inactiveWorkspace = {
inherit text border;
background = unfocused;
};
urgentWorkspace = {
inherit text border;
background = urgent;
};
bindingMode = {
inherit text border;
background = urgent;
};
};
};
}
];
}