From 545b892c84fb69c7ca6230a59ef88c2926efeedb Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Thu, 15 Aug 2024 01:51:20 -0400 Subject: [PATCH] remove theme.colors --- homeManagerModules/apps/vsCodium/default.nix | 4 +- homeManagerModules/apps/zed/default.nix | 10 +- .../desktop/hyprland/settings.nix | 1 - homeManagerModules/desktop/sway/settings.nix | 12 +- homeManagerModules/options.nix | 48 ------- .../services/waybar/default.nix | 10 +- homeManagerModules/theme.nix | 132 ++++-------------- homes/aly/default.nix | 2 + homes/dustin/default.nix | 2 + hosts/common/default.nix | 5 + hosts/mauville/home.nix | 6 - hosts/rustboro/home.nix | 6 - 12 files changed, 50 insertions(+), 188 deletions(-) diff --git a/homeManagerModules/apps/vsCodium/default.nix b/homeManagerModules/apps/vsCodium/default.nix index 3f6c3e1c..90bb5d1d 100644 --- a/homeManagerModules/apps/vsCodium/default.nix +++ b/homeManagerModules/apps/vsCodium/default.nix @@ -34,7 +34,7 @@ in { userSettings = { "diffEditor.ignoreTrimWhitespace" = false; - "editor.fontSize" = cfg.theme.monospaceFont.size + 3; + "editor.fontSize" = config.stylix.fonts.sizes.applications + 3; "editor.formatOnPaste" = true; "editor.formatOnSave" = true; "editor.formatOnType" = true; @@ -77,7 +77,7 @@ in { "shellformat.flag" = "-i 4"; "terminal.external.linuxExec" = lib.getExe cfg.defaultApps.terminal; - "terminal.integrated.fontSize" = cfg.theme.monospaceFont.size + 3; + "terminal.integrated.fontSize" = config.stylix.fonts.sizes.terminal + 3; "update.mode" = "none"; "window.menuBarVisibility" = "hidden"; "window.titleBarStyle" = lib.mkDefault "native"; diff --git a/homeManagerModules/apps/zed/default.nix b/homeManagerModules/apps/zed/default.nix index e419cc90..72f158b7 100644 --- a/homeManagerModules/apps/zed/default.nix +++ b/homeManagerModules/apps/zed/default.nix @@ -48,8 +48,8 @@ in { auto_update = false; autosave.after_delay.milliseconds = 1000; - buffer_font_family = cfg.theme.monospaceFont.name; - buffer_font_size = cfg.theme.monospaceFont.size + 3; + buffer_font_family = config.stylix.fonts.monospace.name; + buffer_font_size = config.stylix.fonts.sizes.applications + 3; current_line_highlight = "line"; indent_guides = { @@ -89,7 +89,7 @@ in { metrics = false; }; - terminal.font_size = cfg.theme.monospaceFont.size + 3; + terminal.font_size = config.stylix.fonts.sizes.terminal + 3; theme = { dark = "Adwaita Pastel Dark"; @@ -97,8 +97,8 @@ in { mode = "system"; }; - ui_font_family = cfg.theme.sansFont.name; - ui_font_size = cfg.theme.sansFont.size + 5; + ui_font_family = config.stylix.fonts.sansSerif.name; + ui_font_size = config.stylix.fonts.sizes.applications + 4; use_autoclose = false; vim_mode = false; }; diff --git a/homeManagerModules/desktop/hyprland/settings.nix b/homeManagerModules/desktop/hyprland/settings.nix index 3c0b44ad..fd8cb998 100644 --- a/homeManagerModules/desktop/hyprland/settings.nix +++ b/homeManagerModules/desktop/hyprland/settings.nix @@ -175,7 +175,6 @@ in { disable_hyprland_logo = true; disable_splash_rendering = true; focus_on_activate = true; - font_family = cfg.theme.sansFont.name; vfr = true; }; diff --git a/homeManagerModules/desktop/sway/settings.nix b/homeManagerModules/desktop/sway/settings.nix index 02d0e2a1..054fbaa5 100644 --- a/homeManagerModules/desktop/sway/settings.nix +++ b/homeManagerModules/desktop/sway/settings.nix @@ -149,12 +149,10 @@ in { }; }; - startup = - [ - {command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";} - {command = lib.getExe pkgs.autotiling;} - ] - ++ lib.optional (!cfg.services.randomWallpaper.enable) {command = "${lib.getExe pkgs.swaybg} -i ${cfg.theme.wallpaper}";}; + startup = [ + {command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";} + {command = lib.getExe pkgs.autotiling;} + ]; window = { titlebar = false; @@ -250,7 +248,7 @@ in { # corner_radius ${toString cfg.theme.borderRadius} shadows enable shadows_on_csd enable - shadow_color ${cfg.theme.colors.shadow} + shadow_color ${config.lib.stylix.colors.withHashtag."base00"}CC default_dim_inactive 0.05 diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index 3d171357..eee03ad5 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -233,59 +233,11 @@ in { type = lib.types.int; }; - colors = { - text = lib.mkOption { - description = "Text color."; - default = "#FFFFFF"; - type = lib.types.str; - }; - - background = lib.mkOption { - description = "Background color."; - default = "#242424"; - type = lib.types.str; - }; - - primary = lib.mkOption { - description = "Primary color."; - default = "#78AEED"; #"#CA9EE6"; - type = lib.types.str; - }; - - secondary = lib.mkOption { - description = "Secondary color."; - default = "#CA9EE6"; #"#99D1DB"; - type = lib.types.str; - }; - - inactive = lib.mkOption { - description = "Inactive color."; - default = "#242424"; - type = lib.types.str; - }; - - shadow = lib.mkOption { - description = "Drop shadow color."; - default = "#1A1A1A"; - type = lib.types.str; - }; - }; - - sansFont = mkFontOption "sans serif" "UbuntuSans Nerd Font" (pkgs.nerdfonts.override {fonts = ["UbuntuSans"];}) 11; - serifFont = mkFontOption "serif" "Vegur" pkgs.vegur 11; - monospaceFont = mkFontOption "monospace" "UbuntuSansMono Nerd Font" (pkgs.nerdfonts.override {fonts = ["UbuntuSans"];}) 11; - gtk.hideTitleBar = lib.mkOption { description = "Whether to hide GTK3/4 titlebars (useful for some window managers)."; default = false; type = lib.types.bool; }; - - wallpaper = lib.mkOption { - description = "Default wallpaper."; - default = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg"; - type = lib.types.str; - }; }; }; } diff --git a/homeManagerModules/services/waybar/default.nix b/homeManagerModules/services/waybar/default.nix index 9ef117db..bea0406b 100644 --- a/homeManagerModules/services/waybar/default.nix +++ b/homeManagerModules/services/waybar/default.nix @@ -312,14 +312,14 @@ in { xdg.configFile."nwg-drawer/drawer.css".text = '' window { - background-color: alpha (${cfg.theme.colors.background}, 0.8); - color: ${cfg.theme.colors.text} + background-color: alpha (${config.lib.stylix.colors.withHashtag."base00"}, ${toString config.stylix.opacity.popups}); + color: ${config.lib.stylix.colors.withHashtag."base05"} } /* search entry */ entry { background-color: rgba (0, 0, 0, 0.2); - border: 4px solid ${cfg.theme.colors.primary}; + border: alpha(${config.lib.stylix.colors.withHashtag."base07"}, ${toString config.stylix.opacity.popups}); border-radius: ${toString cfg.theme.borderRadius}px } @@ -330,10 +330,10 @@ in { } button:active, button:hover, button:focused { - background-color: alpha (${cfg.theme.colors.text}, 0.2); + background-color: alpha (${config.lib.stylix.colors.withHashtag."base05"}, 0.2); border: none; border-radius: ${toString cfg.theme.borderRadius}px; - color: ${cfg.theme.colors.secondary} + color:${config.lib.stylix.colors.withHashtag."base02"} } #category-button { diff --git a/homeManagerModules/theme.nix b/homeManagerModules/theme.nix index 51394bb2..a03262e2 100644 --- a/homeManagerModules/theme.nix +++ b/homeManagerModules/theme.nix @@ -7,107 +7,42 @@ cfg = config.ar.home.theme; gtk = { - extraConfig = lib.attrsets.optionalAttrs (cfg.darkMode) {gtk-application-prefer-dark-theme = 1;}; + extraCss = + lib.strings.optionalString + cfg.gtk.hideTitleBar + '' + /* No (default) title bar on wayland */ + headerbar.default-decoration { + /* You may need to tweak these values depending on your GTK theme */ + margin-bottom: 50px; + margin-top: -100px; - extraCss = '' - @define-color accent_bg_color ${cfg.colors.primary}; - @define-color accent_color @accent_bg_color; - @define-color accent_fg_color ${cfg.colors.text}; - @define-color window_bg_color ${cfg.colors.background}; - @define-color window_fg_color ${cfg.colors.text}; - @define-color view_bg_color ${cfg.colors.background}; - @define-color view_fg_color @window_fg_color; - @define-color headerbar_bg_color ${cfg.colors.background}; - @define-color headerbar_backdrop_color @window_bg_color; - @define-color headerbar_fg_color @window_fg_color; + background: transparent; + padding: 0; + border: 0; + min-height: 0; + font-size: 0; + box-shadow: none; + } - @define-color popover_bg_color ${cfg.colors.background}; - @define-color popover_fg_color @view_fg_color; - @define-color dialog_bg_color @popover_bg_color; - @define-color dialog_fg_color @popover_fg_color; - @define-color card_bg_color @popover_bg_color; - @define-color card_fg_color @window_fg_color; - @define-color sidebar_bg_color @headerbar_bg_color; - @define-color sidebar_fg_color @window_fg_color; - @define-color sidebar_backdrop_color @window_bg_color; - @define-color sidebar_shade_color rgba(0,0,0,0.25); - - ${ - lib.strings.optionalString - cfg.gtk.hideTitleBar - '' - /* No (default) title bar on wayland */ - headerbar.default-decoration { - /* You may need to tweak these values depending on your GTK theme */ - margin-bottom: 50px; - margin-top: -100px; - - background: transparent; - padding: 0; - border: 0; - min-height: 0; - font-size: 0; - box-shadow: none; - } - - /* rm -rf window shadows */ - window.csd, /* gtk4? */ - window.csd decoration { /* gtk3 */ - box-shadow: none; - } - '' - } - ''; + /* rm -rf window shadows */ + window.csd, /* gtk4? */ + window.csd decoration { /* gtk3 */ + box-shadow: none; + } + ''; }; in { config = lib.mkIf cfg.enable { home = { packages = [ - cfg.monospaceFont.package - cfg.sansFont.package - cfg.serifFont.package pkgs.adwaita-qt pkgs.gnome.adwaita-icon-theme pkgs.liberation_ttf ]; - - pointerCursor = { - gtk.enable = true; - name = "Bibata-Modern-Classic"; - package = pkgs.bibata-cursors; - size = lib.mkDefault 24; - - x11 = { - enable = true; - defaultCursor = config.home.pointerCursor.name; - }; - }; - }; - - fonts.fontconfig = { - enable = true; - - defaultFonts = { - monospace = [cfg.monospaceFont.name]; - sansSerif = [cfg.sansFont.name]; - serif = [cfg.serifFont.name]; - }; }; gtk = { - enable = true; - - theme = { - name = - if cfg.darkMode - then "adw-gtk3-dark" - else "adw-gtk3"; - - package = pkgs.adw-gtk3; - }; - - font = {inherit (cfg.sansFont) name package size;}; - iconTheme = { name = if cfg.darkMode @@ -117,8 +52,8 @@ in { package = pkgs.papirus-icon-theme.override {color = "adwaita";}; }; - gtk3 = {inherit (gtk) extraConfig extraCss;}; - gtk4 = {inherit (gtk) extraConfig extraCss;}; + gtk3 = {inherit (gtk) extraCss;}; + gtk4 = {inherit (gtk) extraCss;}; }; qt = { @@ -134,24 +69,5 @@ in { package = pkgs.adwaita-qt6; }; }; - - dconf.settings = { - "org/gnome/desktop/background" = { - picture-uri = "file://${cfg.wallpaper}"; - picture-uri-dark = "file://${cfg.wallpaper}"; - }; - - "org/gnome/desktop/interface" = { - color-scheme = - if cfg.darkMode - then "prefer-dark" - else "prefer-light"; - - document-font-name = "${cfg.serifFont.name} ${toString cfg.serifFont.size}"; - monospace-font-name = "${cfg.monospaceFont.name} ${toString cfg.monospaceFont.size}"; - }; - - "org/gnome/desktop/wm/preferences".titlebar-font = "${cfg.sansFont.name} ${toString cfg.sansFont.size}"; - }; }; } diff --git a/homes/aly/default.nix b/homes/aly/default.nix index 0c182563..9e31d28b 100644 --- a/homes/aly/default.nix +++ b/homes/aly/default.nix @@ -112,5 +112,7 @@ self: { gammastep.enable = true; randomWallpaper.enable = true; }; + + theme.enable = true; }; } diff --git a/homes/dustin/default.nix b/homes/dustin/default.nix index dd244ece..4a1e3509 100644 --- a/homes/dustin/default.nix +++ b/homes/dustin/default.nix @@ -92,5 +92,7 @@ self: { gammastep.enable = true; randomWallpaper.enable = false; }; + + theme.enable = true; }; } diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 0ce6aee4..489ca7f9 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -10,6 +10,11 @@ environment.systemPackages = with pkgs; [git inxi python3]; + home-manager.sharedModules = [ + { + } + ]; + stylix = { enable = true; base16Scheme = "${pkgs.base16-schemes}/share/themes/rose-pine-moon.yaml"; diff --git a/hosts/mauville/home.nix b/hosts/mauville/home.nix index 8f5e9062..adafa5db 100644 --- a/hosts/mauville/home.nix +++ b/hosts/mauville/home.nix @@ -20,12 +20,6 @@ enable = true; preset = "LoudnessEqualizer"; }; - - theme = { - monospaceFont.size = 14; - sansFont.size = 14; - serifFont.size = 14; - }; }; } ]; diff --git a/hosts/rustboro/home.nix b/hosts/rustboro/home.nix index 3dbec73e..e1eb15a3 100644 --- a/hosts/rustboro/home.nix +++ b/hosts/rustboro/home.nix @@ -10,12 +10,6 @@ enable = true; preset = "LoudnessEqualizer"; }; - - theme = { - monospaceFont.size = 14; - sansFont.size = 14; - serifFont.size = 14; - }; }; } ];