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

View file

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

View file

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

View file

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

View file

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