From 5f79d202792abde4eb0e59820dde0b230df9cb92 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 8 May 2024 11:37:38 -0400 Subject: [PATCH] added preferDark option to theme module --- homeManagerModules/apps/vsCodium/default.nix | 4 ++-- homeManagerModules/apps/waybar/default.nix | 2 +- homeManagerModules/desktop/theme.nix | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/homeManagerModules/apps/vsCodium/default.nix b/homeManagerModules/apps/vsCodium/default.nix index 844d5cfb..c9ffeedd 100644 --- a/homeManagerModules/apps/vsCodium/default.nix +++ b/homeManagerModules/apps/vsCodium/default.nix @@ -28,8 +28,8 @@ "update.mode" = "none"; "window.menuBarVisibility" = "hidden"; "window.zoomPerWindow" = false; - "workbench.colorTheme" = "Catppuccin Macchiato"; - "workbench.iconTheme" = "catppuccin-macchiato"; + "workbench.colorTheme" = if config.alyraffauf.desktop.theme.colors.preferDark then "Catppuccin Macchiato" else "Catppuccin Latte"; + "workbench.iconTheme" = if config.alyraffauf.desktop.theme.colors.preferDark then "catppuccin-macchiato" else "catppuccin-latte"; "workbench.preferredDarkColorTheme" = "Catppuccin Macchiato"; "workbench.preferredLightColorTheme" = "Catppuccin Latte"; }; diff --git a/homeManagerModules/apps/waybar/default.nix b/homeManagerModules/apps/waybar/default.nix index 8b83dc44..e32d677a 100644 --- a/homeManagerModules/apps/waybar/default.nix +++ b/homeManagerModules/apps/waybar/default.nix @@ -88,7 +88,7 @@ #clock, #hardware { border-radius: 10; - background: rgba (35, 38, 52, 0.8); + background: rgba ${if config.alyraffauf.desktop.theme.colors.preferDark then "(35, 38, 52, 0.8);" else "(220, 224, 232, 0.8);"} margin: 5px 10px 0px 10px; padding: 0px 10px 0px 10px; } diff --git a/homeManagerModules/desktop/theme.nix b/homeManagerModules/desktop/theme.nix index 9abafc64..735d1532 100644 --- a/homeManagerModules/desktop/theme.nix +++ b/homeManagerModules/desktop/theme.nix @@ -91,6 +91,11 @@ }; }; alyraffauf.desktop.theme.colors = { + preferDark = lib.mkOption { + description = "Whether to prefer dark mode apps or not."; + default = true; + type = lib.types.bool; + }; text = lib.mkOption { description = "Text color."; default = "#FAFAFA"; @@ -163,9 +168,9 @@ size = config.alyraffauf.desktop.theme.font.size; }; - gtk3.extraConfig = {gtk-application-prefer-dark-theme = 1;}; + gtk3.extraConfig = lib.attrsets.optionalAttrs (config.alyraffauf.desktop.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;}; - gtk4.extraConfig = {gtk-application-prefer-dark-theme = 1;}; + gtk4.extraConfig = lib.attrsets.optionalAttrs (config.alyraffauf.desktop.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;}; }; dconf.settings = {