From 76e6626187dde6dd820b8943b1f163dff60b6700 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 3 Jul 2024 10:35:39 -0400 Subject: [PATCH] home/theme: remove abstractions and simplify options * removed gtk and icon theme option abstractions * home/theme: remove cursorTheme options * rustboro/home: migrate cursor theme overrides * home/theme: use config.gtk.font instead of options.nix abstractions * home/them: dark mode/light mode check for icons * home/theme: remove terminalFont options * home: move home.themes.colors.darkMode to home.themes.darkMode * home/them: improve gnome font settings * waybar: stay dark even when in light mode --- homeManagerModules/apps/alacritty/default.nix | 4 +- homeManagerModules/apps/fuzzel/default.nix | 4 +- homeManagerModules/apps/mako/default.nix | 2 +- homeManagerModules/apps/swaylock/default.nix | 2 +- homeManagerModules/apps/vsCodium/default.nix | 4 +- homeManagerModules/apps/waybar/default.nix | 46 +++---- homeManagerModules/apps/wlogout/default.nix | 2 +- .../desktop/hyprland/default.nix | 2 +- homeManagerModules/desktop/sway/default.nix | 4 +- homeManagerModules/options.nix | 122 ++---------------- homeManagerModules/theme.nix | 116 +++++++++++------ hosts/rustboro/home.nix | 10 +- 12 files changed, 124 insertions(+), 194 deletions(-) diff --git a/homeManagerModules/apps/alacritty/default.nix b/homeManagerModules/apps/alacritty/default.nix index d6307e48..290b0609 100644 --- a/homeManagerModules/apps/alacritty/default.nix +++ b/homeManagerModules/apps/alacritty/default.nix @@ -18,10 +18,10 @@ }; font = { normal = { - family = "${config.ar.home.theme.terminalFont.name}"; + family = "NotoSansM Nerd Font"; style = "Regular"; }; - size = config.ar.home.theme.terminalFont.size; + size = config.gtk.font.size; }; selection.save_to_clipboard = true; window = { diff --git a/homeManagerModules/apps/fuzzel/default.nix b/homeManagerModules/apps/fuzzel/default.nix index ab1f35fa..fe96bbe2 100644 --- a/homeManagerModules/apps/fuzzel/default.nix +++ b/homeManagerModules/apps/fuzzel/default.nix @@ -14,8 +14,8 @@ }; main = { - font = "${config.ar.home.theme.terminalFont.name}:size=${toString config.ar.home.theme.terminalFont.size}"; - icon-theme = "${config.ar.home.theme.iconTheme.name}"; + font = "NotoSansM Nerd Font:size=${toString config.gtk.font.size}"; + icon-theme = "${config.gtk.iconTheme.name}"; layer = "overlay"; lines = 3; terminal = lib.getExe config.ar.home.defaultApps.terminal; diff --git a/homeManagerModules/apps/mako/default.nix b/homeManagerModules/apps/mako/default.nix index d60d65fe..04dd5d4d 100644 --- a/homeManagerModules/apps/mako/default.nix +++ b/homeManagerModules/apps/mako/default.nix @@ -13,7 +13,7 @@ borderSize = 2; borderRadius = 10; defaultTimeout = 10000; - font = "${config.ar.home.theme.font.name} Regular ${toString config.ar.home.theme.font.size}"; + font = "${config.gtk.font.name} Regular ${toString config.gtk.font.size}"; height = 300; layer = "top"; padding = "15"; diff --git a/homeManagerModules/apps/swaylock/default.nix b/homeManagerModules/apps/swaylock/default.nix index 0c523c64..f40ca731 100644 --- a/homeManagerModules/apps/swaylock/default.nix +++ b/homeManagerModules/apps/swaylock/default.nix @@ -15,7 +15,7 @@ caps-lock-key-hl-color=e78284 color=303446 daemonize - font="${config.ar.home.theme.terminalFont.name}-Regular" + font="NotoSansMNerdFont-Regular" image=${config.ar.home.theme.wallpaper} indicator-caps-lock indicator-idle-visible diff --git a/homeManagerModules/apps/vsCodium/default.nix b/homeManagerModules/apps/vsCodium/default.nix index 3f31a5d5..0626653e 100644 --- a/homeManagerModules/apps/vsCodium/default.nix +++ b/homeManagerModules/apps/vsCodium/default.nix @@ -12,7 +12,7 @@ enableExtensionUpdateCheck = false; userSettings = { "diffEditor.ignoreTrimWhitespace" = false; - "editor.fontFamily" = "'NotoSansM Nerd Font','${config.ar.home.theme.terminalFont.name}', 'monospace', monospace"; + "editor.fontFamily" = "'NotoSansM Nerd Font', 'monospace', monospace"; "editor.fontSize" = lib.mkDefault 14; "editor.rulers" = [80]; "explorer.confirmDelete" = false; @@ -30,7 +30,7 @@ else "native"; "window.zoomPerWindow" = false; "workbench.colorTheme" = - if config.ar.home.theme.colors.preferDark + if config.ar.home.theme.darkMode then "Adwaita Dark" else "Adwaita Light"; "workbench.iconTheme" = "null"; diff --git a/homeManagerModules/apps/waybar/default.nix b/homeManagerModules/apps/waybar/default.nix index fc69f009..ccaa14e6 100644 --- a/homeManagerModules/apps/waybar/default.nix +++ b/homeManagerModules/apps/waybar/default.nix @@ -172,44 +172,44 @@ xdg.configFile."waybar/style.css".text = '' * { - border: none; - border-radius: 0; - font-family: "${config.ar.home.theme.terminalFont.name}"; - font-size: 14px; - font-weight: 600; + border: none; + border-radius: 0; + font-family: "NotoSansM Nerd Font"; + font-size: 14px; + font-weight: 600; } window#waybar { - background: rgba (35, 38, 52, 0.0); - color: ${config.ar.home.theme.colors.text}; + background: rgba (35, 38, 52, 0.0); + color: ${config.ar.home.theme.colors.text}; } #workspaces button { - padding: 0px 5px; - margin: 0 0px; - color: ${config.ar.home.theme.colors.text}; + padding: 0px 5px; + margin: 0 0px; + color: ${config.ar.home.theme.colors.text}; } #workspaces button.active, #workspaces button.focused { - color: ${config.ar.home.theme.colors.primary}; + color: ${config.ar.home.theme.colors.primary}; } #submap, #mode { - padding: 0 15px; - margin: 0 5px; - color: #FFFFFF; + padding: 0 15px; + margin: 0 5px; + color: #FFFFFF; } #tags button { - padding: 0px 5px; - margin: 0 0px; - color: ${config.ar.home.theme.colors.text}; + padding: 0px 5px; + margin: 0 0px; + color: ${config.ar.home.theme.colors.text}; } #tags button.focused { - color: ${config.ar.home.theme.colors.primary}; + color: ${config.ar.home.theme.colors.primary}; } #clock, @@ -224,8 +224,8 @@ #custom-menu, #custom-sway-close, #tray { - padding: 0 7.5px; - margin: 0 5px; + padding: 0 7.5px; + margin: 0 5px; } #battery { @@ -251,11 +251,7 @@ #custom-hyprland-close, #hardware { border-radius: 10; - background: rgba ${ - if config.ar.home.theme.colors.preferDark - then "(36, 36, 36, 0.8);" - else "(250, 250, 250, 0.8);" - } + background: rgba (36, 36, 36, 0.8); margin: 5px 10px 0px 10px; padding: 0px 10px 0px 10px; } diff --git a/homeManagerModules/apps/wlogout/default.nix b/homeManagerModules/apps/wlogout/default.nix index e12f2692..392e52c2 100644 --- a/homeManagerModules/apps/wlogout/default.nix +++ b/homeManagerModules/apps/wlogout/default.nix @@ -33,7 +33,7 @@ * { background-image: none; box-shadow: none; - font-family: "${config.ar.home.theme.font.name}", sans-serif; + font-family: "${config.gtk.font.name}", sans-serif; transition: 20ms; } diff --git a/homeManagerModules/desktop/hyprland/default.nix b/homeManagerModules/desktop/hyprland/default.nix index 177a6c0e..009a9fef 100644 --- a/homeManagerModules/desktop/hyprland/default.nix +++ b/homeManagerModules/desktop/hyprland/default.nix @@ -214,7 +214,7 @@ env = GDK_SCALE,${gdk_scale} # Some default env vars. - env = XCURSOR_SIZE,${toString config.ar.home.theme.cursorTheme.size} + env = XCURSOR_SIZE,${toString config.home.pointerCursor.size} env = QT_QPA_PLATFORMTHEME,qt6ct # Execute necessary apps diff --git a/homeManagerModules/desktop/sway/default.nix b/homeManagerModules/desktop/sway/default.nix index 611873fc..61766a1a 100644 --- a/homeManagerModules/desktop/sway/default.nix +++ b/homeManagerModules/desktop/sway/default.nix @@ -115,9 +115,9 @@ # mouseWarping = "container"; }; fonts = { - names = ["${config.ar.home.theme.font.name}"]; + names = ["${config.gtk.font.name}"]; style = "Bold"; - size = config.ar.home.theme.font.size + 0.0; + size = config.gtk.font.size + 0.0; }; gaps.inner = 5; gaps.outer = 5; diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index 1373f38b..a22d2d38 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -235,121 +235,13 @@ theme = { enable = lib.mkEnableOption "Gtk, Qt, and application colors."; - gtk = { - name = lib.mkOption { - description = "GTK theme name."; - default = "adw-gtk3-dark"; - type = lib.types.str; - }; - - package = lib.mkOption { - description = "GTK theme package."; - default = pkgs.adw-gtk3; - type = lib.types.package; - }; - - hideTitleBar = lib.mkOption { - description = "Whether to hide GTK3/4 titlebars (useful for some window managers)."; - default = false; - type = lib.types.bool; - }; - }; - - qt = { - name = lib.mkOption { - description = "Qt theme name."; - default = "Adwaita-Dark"; - type = lib.types.str; - }; - - package = lib.mkOption { - description = "Qt theme package."; - default = pkgs.adwaita-qt; - type = lib.types.package; - }; - }; - - iconTheme = { - name = lib.mkOption { - description = "Icon theme name."; - default = "Papirus-Dark"; - type = lib.types.str; - }; - - package = lib.mkOption { - description = "Icon theme package."; - default = pkgs.papirus-icon-theme; - type = lib.types.package; - }; - }; - - cursorTheme = { - name = lib.mkOption { - description = "Cursor theme name."; - default = "Bibata-Modern-Classic"; - type = lib.types.str; - }; - - size = lib.mkOption { - description = "Cursor size."; - default = 20; - type = lib.types.int; - }; - - package = lib.mkOption { - description = "Cursor theme package."; - default = pkgs.bibata-cursors; - type = lib.types.package; - }; - }; - - font = { - name = lib.mkOption { - description = "Font name."; - default = "NotoSans Nerd Font"; - type = lib.types.str; - }; - - size = lib.mkOption { - description = "Font size."; - default = 11; - type = lib.types.int; - }; - - package = lib.mkOption { - description = "Font package."; - default = pkgs.nerdfonts; - type = lib.types.package; - }; - }; - - terminalFont = { - name = lib.mkOption { - description = "Font name."; - default = "NotoSansM Nerd Font"; - type = lib.types.str; - }; - - size = lib.mkOption { - description = "Font size."; - default = 11; - type = lib.types.int; - }; - - package = lib.mkOption { - description = "Font package."; - default = pkgs.nerdfonts; - type = lib.types.package; - }; + darkMode = lib.mkOption { + description = "Whether to prefer dark mode apps or not."; + default = config.ar.home.theme.enable; + type = lib.types.bool; }; colors = { - preferDark = lib.mkOption { - description = "Whether to prefer dark mode apps or not."; - default = config.ar.home.theme.enable; - type = lib.types.bool; - }; - text = lib.mkOption { description = "Text color."; default = "#FFFFFF"; @@ -387,6 +279,12 @@ }; }; + 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"; diff --git a/homeManagerModules/theme.nix b/homeManagerModules/theme.nix index 0f8487e9..45a8d664 100644 --- a/homeManagerModules/theme.nix +++ b/homeManagerModules/theme.nix @@ -10,32 +10,23 @@ pointerCursor = { gtk.enable = true; - name = config.ar.home.theme.cursorTheme.name; - package = config.ar.home.theme.cursorTheme.package; - size = config.ar.home.theme.cursorTheme.size; + name = "Bibata-Modern-Classic"; + package = pkgs.bibata-cursors; + size = lib.mkDefault 20; x11 = { enable = true; - defaultCursor = config.ar.home.theme.cursorTheme.name; + defaultCursor = config.home.pointerCursor.name; }; }; }; - qt = { - enable = true; - platformTheme.name = "qtct"; - style = { - package = config.ar.home.theme.qt.package; - name = config.ar.home.theme.qt.name; - }; - }; - fonts.fontconfig = { enable = true; defaultFonts = { - monospace = [config.ar.home.theme.terminalFont.name]; + monospace = ["NotoSansM Nerd Font"]; serif = ["NotoSerif Nerd Font"]; - sansSerif = [config.ar.home.theme.font.name]; + sansSerif = [config.gtk.font.name]; }; }; @@ -43,24 +34,30 @@ enable = true; theme = { - package = config.ar.home.theme.gtk.package; - name = config.ar.home.theme.gtk.name; + package = pkgs.adw-gtk3; + name = + if config.ar.home.theme.darkMode + then "adw-gtk3-dark" + else "adw-gtk3"; }; iconTheme = { - package = config.ar.home.theme.iconTheme.package; - name = config.ar.home.theme.iconTheme.name; + package = pkgs.papirus-icon-theme; + name = + if config.ar.home.theme.darkMode + then "Papirus-Dark" + else "Papirus"; }; font = { - name = "${config.ar.home.theme.font.name} Regular"; - package = config.ar.home.theme.font.package; - size = config.ar.home.theme.font.size; + name = "NotoSans Nerd Font"; + package = pkgs.nerdfonts; + size = lib.mkDefault 11; }; - gtk3.extraConfig = lib.attrsets.optionalAttrs (config.ar.home.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;}; + gtk3.extraConfig = lib.attrsets.optionalAttrs (config.ar.home.theme.darkMode) {gtk-application-prefer-dark-theme = 1;}; - gtk4.extraConfig = lib.attrsets.optionalAttrs (config.ar.home.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;}; + gtk4.extraConfig = lib.attrsets.optionalAttrs (config.ar.home.theme.darkMode) {gtk-application-prefer-dark-theme = 1;}; gtk3.extraCss = '' @define-color accent_bg_color ${config.ar.home.theme.colors.primary}; @@ -96,35 +93,74 @@ gtk4.extraCss = config.gtk.gtk3.extraCss; }; + qt = { + enable = true; + platformTheme.name = "qtct"; + style = { + package = pkgs.adwaita-qt; + name = + if config.ar.home.theme.darkMode + then "Adwaita Dark" + else "Adwaita"; + }; + }; + dconf.settings = { "org/cinnamon/desktop/background".picture-uri = "file://${config.ar.home.theme.wallpaper}"; "org/cinnamon/desktop/interface" = { - cursor-size = config.ar.home.theme.cursorTheme.size; - cursor-theme = config.ar.home.theme.cursorTheme.name; - font-name = "${config.ar.home.theme.font.name} Regular ${toString config.ar.home.theme.font.size}"; - gtk-theme = config.ar.home.theme.gtk.name; - icon-theme = config.ar.home.theme.iconTheme.name; + cursor-size = config.home.pointerCursor.size; + cursor-theme = config.home.pointerCursor.name; + font-name = "${config.gtk.font.name} ${toString config.gtk.font.size}"; + + gtk-theme = + if config.ar.home.theme.darkMode + then "adw-gtk3-dark" + else "adw-gtk3"; + + icon-theme = + if config.ar.home.theme.darkMode + then "Papirus-Dark" + else "Papirus"; }; - "org/cinnamon/theme".name = config.ar.home.theme.gtk.name; - "org/cinnamon/desktop/wm/preferences".titlebar-font = "${config.ar.home.theme.font.name} ${toString config.ar.home.theme.font.size}"; + "org/cinnamon/theme".name = + if config.ar.home.theme.darkMode + then "adw-gtk3-dark" + else "adw-gtk3"; + + "org/cinnamon/desktop/wm/preferences".titlebar-font = "${config.gtk.font.name} ${toString config.gtk.font.size}"; + + "org/gnome/desktop/background" = { + picture-uri = "file://${config.ar.home.theme.wallpaper}"; + picture-uri-dark = "file://${config.ar.home.theme.wallpaper}"; + }; - "org/gnome/desktop/background".picture-uri = "file://${config.ar.home.theme.wallpaper}"; - "org/gnome/desktop/background".picture-uri-dark = "file://${config.ar.home.theme.wallpaper}"; "org/gnome/desktop/interface" = { color-scheme = - if config.ar.home.theme.colors.preferDark + if config.ar.home.theme.darkMode then "prefer-dark" else "prefer-light"; - cursor-theme = config.ar.home.theme.cursorTheme.name; - cursor-size = config.ar.home.theme.cursorTheme.size; - gtk-theme = config.ar.home.theme.gtk.name; - icon-theme = config.ar.home.theme.iconTheme.name; - monospace-font-name = "${config.ar.home.theme.terminalFont.name} Regular ${toString config.ar.home.theme.terminalFont.size}"; + + cursor-theme = config.home.pointerCursor.name; + cursor-size = config.home.pointerCursor.size; + + document-font-name = "NotoSerif Nerd Font ${toString config.gtk.font.size}"; + + gtk-theme = + if config.ar.home.theme.darkMode + then "adw-gtk3-dark" + else "adw-gtk3"; + + icon-theme = + if config.ar.home.theme.darkMode + then "Papirus-Dark" + else "Papirus"; + + monospace-font-name = "NotoSansM Nerd Font ${toString config.gtk.font.size}"; }; - "org/gnome/desktop/wm/preferences".titlebar-font = "${config.ar.home.theme.font.name} ${toString config.ar.home.theme.font.size}"; + "org/gnome/desktop/wm/preferences".titlebar-font = "${config.gtk.font.name} ${toString config.gtk.font.size}"; }; }; } diff --git a/hosts/rustboro/home.nix b/hosts/rustboro/home.nix index 8b2c75eb..0522c636 100644 --- a/hosts/rustboro/home.nix +++ b/hosts/rustboro/home.nix @@ -11,16 +11,16 @@ programs.vscode.userSettings = { "editor.fontSize" = lib.mkForce "16"; }; + + home.pointerCursor.size = lib.mkForce 24; + + gtk.font.size = lib.mkForce 14; + ar.home = { services.easyeffects = { enable = true; preset = "LoudnessEqualizer"; }; - theme = { - cursorTheme.size = lib.mkForce 24; - font.size = lib.mkForce 14; - terminalFont.size = lib.mkForce 14; - }; }; } ];