treewide: conditionally add theming

This commit is contained in:
Anthony Rodriguez 2024-11-21 17:44:42 +01:00
parent 81852b26d2
commit f06229cc33
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
5 changed files with 207 additions and 193 deletions

View file

@ -5,7 +5,7 @@
osConfig,
...
}: let
inherit (osConfig.theme.scheme) palette;
inherit (lib) mkMerge mkIf;
in {
imports = [./binds.nix];
@ -22,7 +22,8 @@ in {
};
};
programs.niri = {
programs.niri = mkMerge [
{
settings = {
input = {
power-key-handling.enable = false;
@ -38,7 +39,6 @@ in {
layout = {
focus-ring = {
enable = true;
active.color = palette.base0E;
};
always-center-single-column = true;
};
@ -94,7 +94,13 @@ in {
"_JAVA_AWT_WM_NONREPARENTING" = "1"; # https://wiki.archlinux.org/title/Sway#Java_applications
};
};
};
}
(mkIf osConfig.theme.enable (let
inherit (osConfig.theme.scheme) palette;
in {
layout.focus-ring.active.color = palette.base0E;
}))
];
# copied from https://github.com/linyinfeng/dotfiles/blob/c00fe3b1562ad947672863a43e455bc2f01a56b6/home-manager/profiles/niri/default.nix#L594-L611
systemd.user.services.xwayland-satellite = {

View file

@ -1,9 +1,10 @@
{
pkgs,
osConfig,
lib,
...
}: let
inherit (osConfig.theme.scheme) palette;
inherit (lib) mkMerge mkIf;
in {
# requires `security.pam.services.swaylock = { };` at the system level or else
# unlock will not work.
@ -11,7 +12,8 @@ in {
enable = true;
package = pkgs.swaylock-effects;
settings = {
settings = mkMerge [
{
clock = true;
timestr = "%H:%M";
@ -25,7 +27,12 @@ in {
effect-pixelate = 5;
ignore-empty-password = false; # needed for PAM to work with fprintd / password
}
(mkIf
osConfig.theme.enable
(let
inherit (osConfig.theme.scheme) palette;
in {
inside-color = palette.base01;
inside-clear-color = palette.base0C;
inside-caps-lock-color = palette.base09;
@ -51,6 +58,7 @@ in {
text-caps-lock-color = palette.base04;
text-ver-color = palette.base04;
text-wrong-color = palette.base04;
};
}))
];
};
}

View file

@ -5,20 +5,16 @@
}: let
inherit (osConfig.theme.scheme) palette;
inherit (builtins) concatStringsSep;
inherit (lib) mapAttrsToList;
inherit (lib) mapAttrsToList mkIf mkMerge;
generateGtkColors = palette: (concatStringsSep "\n"
(mapAttrsToList
(name: color: "@define-color ${name} ${color};")
palette));
in {
programs.waybar.style = ''
${
if osConfig.theme.enable
then generateGtkColors palette
else ""
}
programs.waybar.style = mkMerge [
(mkIf osConfig.theme.enable generateGtkColors palette)
''
* {
/* `otf-font-awesome` is required to be installed for icons */
border: none;
@ -106,5 +102,6 @@ in {
padding: 0 1.2em;
color: @base08;
}
'';
''
];
}

View file

@ -3,7 +3,9 @@
config,
lib,
...
}: {
}: let
inherit (lib) mkIf;
in {
programs.foot = {
enable = true;
settings = {
@ -12,7 +14,7 @@
font = "monospace:size=14";
shell = "${lib.getExe config.programs.fish.package}";
};
colors = let
colors = mkIf osConfig.theme.enable (let
inherit (lib) mapAttrs;
inherit (lib.strings) removePrefix;
# because someone thought this was a great idea: https://github.com/tinted-theming/schemes/commit/61058a8d2e2bd4482b53d57a68feb56cdb991f0b
@ -38,7 +40,7 @@
bright5 = palette.base0E;
bright6 = palette.base0C;
bright7 = palette.base07;
};
});
};
};
}

View file

@ -1,6 +1,7 @@
{
theme = {
wallpaper = ../../../wallpapers/lucy-edgerunners-wallpaper.jpg;
schemeName = "catppuccin-macchiato";
enable = true;
gtk.enable = false;
};