From ff9ae322bcaeccabc65812390000276455331123 Mon Sep 17 00:00:00 2001 From: awwpotato <153149335+awwpotato@users.noreply.github.com> Date: Tue, 18 Mar 2025 05:10:02 -0700 Subject: [PATCH] treewide: clean up `with` and stuff (#975) Fixes #973 --- modules/avizo/hm.nix | 10 +- modules/bemenu/hm.nix | 59 ++--- modules/bspwm/hm.nix | 17 +- modules/btop/hm.nix | 95 ++++---- modules/console/nixos.nix | 41 ++-- modules/discord/hm.nix | 10 +- modules/dunst/hm.nix | 7 +- modules/emacs/hm.nix | 86 +++---- modules/foot/hm.nix | 8 +- modules/fuzzel/hm.nix | 6 +- modules/grub/nixos.nix | 155 ++++++------ modules/hyprlock/hm.nix | 11 +- modules/i3/hm.nix | 165 +++++++------ modules/i3status-rust/hm.nix | 35 ++- modules/k9s/hm.nix | 5 +- modules/kubecolor/hm.nix | 78 +++---- modules/mako/hm.nix | 42 ++-- modules/mangohud/hm.nix | 4 +- modules/ncspot/hm.nix | 48 ++-- modules/nixos-icons/nixos.nix | 5 +- modules/nushell/hm.nix | 79 +++---- modules/qutebrowser/hm.nix | 427 +++++++++++++++++----------------- modules/rio/hm.nix | 5 +- modules/rofi/hm.nix | 5 +- modules/sway/hm.nix | 175 +++++++------- modules/swaylock/hm.nix | 20 +- modules/swaync/hm.nix | 6 +- modules/tofi/hm.nix | 4 +- modules/vscode/hm.nix | 2 - modules/wezterm/hm.nix | 9 +- modules/wofi/hm.nix | 57 +++-- 31 files changed, 802 insertions(+), 874 deletions(-) diff --git a/modules/avizo/hm.nix b/modules/avizo/hm.nix index 7ad1517f..7f831b0a 100644 --- a/modules/avizo/hm.nix +++ b/modules/avizo/hm.nix @@ -4,12 +4,6 @@ options, ... }: - -with config.lib.stylix.colors; -with config.stylix.fonts; -let - aviOpacity = toString config.stylix.opacity.popups; -in { options.stylix.targets.avizo.enable = config.lib.stylix.mkEnableTarget "Avizo" true; @@ -19,12 +13,12 @@ in lib.mkIf (config.stylix.enable && config.stylix.targets.avizo.enable) { services.avizo = { settings = { - default = { + default = with config.lib.stylix.colors; { background = "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, ${aviOpacity})"; border-color = "rgba(${base0D-rgb-r}, ${base0D-rgb-g}, ${base0D-rgb-b}, ${aviOpacity})"; bar-fg-color = "rgba(${base05-rgb-r}, ${base05-rgb-g}, ${base05-rgb-b}, ${aviOpacity})"; bar-bg-color = "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, ${aviOpacity})"; - image-opacity = aviOpacity; + image-opacity = toString config.stylix.opacity.popups; }; }; }; diff --git a/modules/bemenu/hm.nix b/modules/bemenu/hm.nix index 1b2e97ab..b5fc2663 100644 --- a/modules/bemenu/hm.nix +++ b/modules/bemenu/hm.nix @@ -1,12 +1,4 @@ { config, lib, ... }: - -with config.lib.stylix.colors.withHashtag; -with config.stylix.fonts; -let - bemenuOpacity = lib.toHexString ( - ((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100 - ); -in { options.stylix.targets.bemenu = { enable = config.lib.stylix.mkEnableTarget "bemenu" true; @@ -16,7 +8,7 @@ in Font size used for bemenu. ''; type = with lib.types; nullOr int; - default = sizes.popups; + default = config.stylix.fonts.sizes.popups; }; # optional argument alternate = lib.mkOption { @@ -31,28 +23,37 @@ in config = lib.mkIf (config.stylix.enable && config.stylix.targets.bemenu.enable) { - programs.bemenu.settings = with config.stylix.targets.bemenu; { - tb = "${base01}${bemenuOpacity}"; # Title bg - nb = "${base01}${bemenuOpacity}"; # Normal bg - fb = "${base01}${bemenuOpacity}"; # Filter bg - hb = "${base03}${bemenuOpacity}"; # Highlighted bg - sb = "${base03}${bemenuOpacity}"; # Selected bg - scb = "${base01}"; # Scrollbar bg + programs.bemenu.settings = + with config.lib.stylix.colors.withHashtag; + with config.stylix.fonts; + with config.stylix.targets.bemenu; + let + bemenuOpacity = lib.toHexString ( + ((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100 + ); + in + { + tb = "${base01}${bemenuOpacity}"; # Title bg + nb = "${base01}${bemenuOpacity}"; # Normal bg + fb = "${base01}${bemenuOpacity}"; # Filter bg + hb = "${base03}${bemenuOpacity}"; # Highlighted bg + sb = "${base03}${bemenuOpacity}"; # Selected bg + scb = "${base01}"; # Scrollbar bg - hf = "${base0A}"; # Highlighted fg - sf = "${base0B}"; # Selected fg - tf = "${base05}"; # Title fg - ff = "${base05}"; # Filter fg - nf = "${base05}"; # Normal fg - scf = "${base03}"; # Scrollbar fg + hf = "${base0A}"; # Highlighted fg + sf = "${base0B}"; # Selected fg + tf = "${base05}"; # Title fg + ff = "${base05}"; # Filter fg + nf = "${base05}"; # Normal fg + scf = "${base03}"; # Scrollbar fg - ab = "${if alternate then base00 else base01}"; # Alternate bg - af = "${if alternate then base04 else base05}"; # Alternate fg + ab = "${if alternate then base00 else base01}"; # Alternate bg + af = "${if alternate then base04 else base05}"; # Alternate fg - # Font name - fn = "${sansSerif.name} ${ - lib.optionalString (fontSize != null) (builtins.toString fontSize) - }"; - }; + # Font name + fn = "${sansSerif.name} ${ + lib.optionalString (fontSize != null) (builtins.toString fontSize) + }"; + }; }; } diff --git a/modules/bspwm/hm.nix b/modules/bspwm/hm.nix index 36d360d0..2df8691a 100644 --- a/modules/bspwm/hm.nix +++ b/modules/bspwm/hm.nix @@ -1,18 +1,15 @@ { config, lib, ... }: - -let - colors = config.lib.stylix.colors.withHashtag; -in { options.stylix.targets.bspwm.enable = config.lib.stylix.mkEnableTarget "bspwm" true; config = lib.mkIf (config.stylix.enable && config.stylix.targets.bspwm.enable) { - xsession.windowManager.bspwm.settings = { - normal_border_color = colors.base03; - active_border_color = colors.base0C; - focused_border_color = colors.base0D; - presel_feedback_color = colors.base00; - }; + xsession.windowManager.bspwm.settings = + with config.lib.stylix.colors.withHashtag; { + normal_border_color = base03; + active_border_color = base0C; + focused_border_color = base0D; + presel_feedback_color = base00; + }; }; } diff --git a/modules/btop/hm.nix b/modules/btop/hm.nix index 0a722230..fc7d265e 100644 --- a/modules/btop/hm.nix +++ b/modules/btop/hm.nix @@ -1,8 +1,4 @@ { config, lib, ... }: - -let - colors = config.lib.stylix.colors.withHashtag; -in { options.stylix.targets.btop.enable = config.lib.stylix.mkEnableTarget "btop" true; @@ -21,50 +17,51 @@ in theme_background = lib.mkIf (config.stylix.opacity.terminal != 1.0) false; }; - xdg.configFile."btop/themes/stylix.theme".text = with colors; '' - #Generated by Stylix - theme[main_bg]="${base00}" - theme[main_fg]="${base05}" - theme[title]="${base05}" - theme[hi_fg]="${base0D}" - theme[selected_bg]="${base03}" - theme[selected_fg]="${base0D}" - theme[inactive_fg]="${base04}" - theme[graph_text]="${base06}" - theme[meter_bg]="${base03}" - theme[proc_misc]="${base06}" - theme[cpu_box]="${base0E}" - theme[mem_box]="${base0B}" - theme[net_box]="${base0C}" - theme[proc_box]="${base0D}" - theme[div_line]="${base01}" - theme[temp_start]="${base0B}" - theme[temp_mid]="${base0A}" - theme[temp_end]="${base08}" - theme[cpu_start]="${base0B}" - theme[cpu_mid]="${base0A}" - theme[cpu_end]="${base08}" - theme[free_start]="${base0A}" - theme[free_mid]="${base0B}" - theme[free_end]="${base0B}" - theme[cached_start]="${base0C}" - theme[cached_mid]="${base0C}" - theme[cached_end]="${base0A}" - theme[available_start]="${base08}" - theme[available_mid]="${base0A}" - theme[available_end]="${base0B}" - theme[used_start]="${base0A}" - theme[used_mid]="${base09}" - theme[used_end]="${base08}" - theme[download_start]="${base0B}" - theme[download_mid]="${base0A}" - theme[download_end]="${base08}" - theme[upload_start]="${base0B}" - theme[upload_mid]="${base0A}" - theme[upload_end]="${base08}" - theme[process_start]="${base0B}" - theme[process_mid]="${base0A}" - theme[process_end]="${base08}" - ''; + xdg.configFile."btop/themes/stylix.theme".text = + with config.lib.stylix.colors.withHashtag; '' + #Generated by Stylix + theme[main_bg]="${base00}" + theme[main_fg]="${base05}" + theme[title]="${base05}" + theme[hi_fg]="${base0D}" + theme[selected_bg]="${base03}" + theme[selected_fg]="${base0D}" + theme[inactive_fg]="${base04}" + theme[graph_text]="${base06}" + theme[meter_bg]="${base03}" + theme[proc_misc]="${base06}" + theme[cpu_box]="${base0E}" + theme[mem_box]="${base0B}" + theme[net_box]="${base0C}" + theme[proc_box]="${base0D}" + theme[div_line]="${base01}" + theme[temp_start]="${base0B}" + theme[temp_mid]="${base0A}" + theme[temp_end]="${base08}" + theme[cpu_start]="${base0B}" + theme[cpu_mid]="${base0A}" + theme[cpu_end]="${base08}" + theme[free_start]="${base0A}" + theme[free_mid]="${base0B}" + theme[free_end]="${base0B}" + theme[cached_start]="${base0C}" + theme[cached_mid]="${base0C}" + theme[cached_end]="${base0A}" + theme[available_start]="${base08}" + theme[available_mid]="${base0A}" + theme[available_end]="${base0B}" + theme[used_start]="${base0A}" + theme[used_mid]="${base09}" + theme[used_end]="${base08}" + theme[download_start]="${base0B}" + theme[download_mid]="${base0A}" + theme[download_end]="${base08}" + theme[upload_start]="${base0B}" + theme[upload_mid]="${base0A}" + theme[upload_end]="${base08}" + theme[process_start]="${base0B}" + theme[process_mid]="${base0A}" + theme[process_end]="${base08}" + ''; }; } diff --git a/modules/console/nixos.nix b/modules/console/nixos.nix index 5f7b103a..2b49f165 100644 --- a/modules/console/nixos.nix +++ b/modules/console/nixos.nix @@ -1,29 +1,26 @@ { config, lib, ... }: - -with config.lib.stylix.colors; - { options.stylix.targets.console.enable = config.lib.stylix.mkEnableTarget "the Linux kernel console" true; config.console.colors = - lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable) - [ - base00-hex - red - green - yellow - blue - magenta - cyan - base05-hex - base03-hex - red - green - yellow - blue - magenta - cyan - base06-hex - ]; + with config.lib.stylix.colors; + lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable) [ + base00-hex + red + green + yellow + blue + magenta + cyan + base05-hex + base03-hex + red + green + yellow + blue + magenta + cyan + base06-hex + ]; } diff --git a/modules/discord/hm.nix b/modules/discord/hm.nix index b9133ab1..48c5f9bd 100644 --- a/modules/discord/hm.nix +++ b/modules/discord/hm.nix @@ -6,12 +6,10 @@ ... }: let - template = - let - inherit (config.lib.stylix) colors; - inherit (config.stylix) fonts; - in - import ./template.nix { inherit colors fonts; }; + template = import ./template.nix { + inherit (config.lib.stylix) colors; + inherit (config.stylix) fonts; + }; in { options.stylix.targets = diff --git a/modules/dunst/hm.nix b/modules/dunst/hm.nix index f22f8b62..c13dcf53 100644 --- a/modules/dunst/hm.nix +++ b/modules/dunst/hm.nix @@ -1,7 +1,4 @@ { config, lib, ... }: - -with config.lib.stylix.colors.withHashtag; -with config.stylix.fonts; let dunstOpacity = lib.toHexString ( ((builtins.floor (config.stylix.opacity.popups * 100 + 0.5)) * 255) / 100 @@ -12,10 +9,10 @@ in config.lib.stylix.mkEnableTarget "Dunst" true; config = lib.mkIf (config.stylix.enable && config.stylix.targets.dunst.enable) { - services.dunst.settings = { + services.dunst.settings = with config.lib.stylix.colors.withHashtag; { global = { separator_color = base02; - font = "${sansSerif.name} ${toString sizes.popups}"; + font = with config.stylix.fonts; "${sansSerif.name} ${toString sizes.popups}"; }; urgency_low = { diff --git a/modules/emacs/hm.nix b/modules/emacs/hm.nix index c090f7a2..e3d61edf 100644 --- a/modules/emacs/hm.nix +++ b/modules/emacs/hm.nix @@ -4,15 +4,12 @@ lib, ... }: - -with config.lib.stylix.colors.withHashtag; -with config.stylix.fonts; - let + inherit (config.stylix) fonts; emacsOpacity = builtins.toString ( builtins.ceil (config.stylix.opacity.applications * 100) ); - emacsSize = builtins.toString (sizes.terminal * 1.0); + emacsSize = builtins.toString (fonts.sizes.terminal * 1.0); in { options.stylix.targets.emacs.enable = @@ -21,49 +18,52 @@ in config = lib.mkIf (config.stylix.enable && config.stylix.targets.emacs.enable) { programs.emacs = { extraPackages = epkgs: [ - (epkgs.trivialBuild { - pname = "base16-stylix-theme"; - version = "0.1.0"; - src = pkgs.writeText "base16-stylix-theme.el" '' - (require 'base16-theme) + (epkgs.trivialBuild ( + with config.lib.stylix.colors.withHashtag; + { + pname = "base16-stylix-theme"; + version = "0.1.0"; + src = pkgs.writeText "base16-stylix-theme.el" '' + (require 'base16-theme) - (defvar base16-stylix-theme-colors - '(:base00 "${base00}" - :base01 "${base01}" - :base02 "${base02}" - :base03 "${base03}" - :base04 "${base04}" - :base05 "${base05}" - :base06 "${base06}" - :base07 "${base07}" - :base08 "${base08}" - :base09 "${base09}" - :base0A "${base0A}" - :base0B "${base0B}" - :base0C "${base0C}" - :base0D "${base0D}" - :base0E "${base0E}" - :base0F "${base0F}") - "All colors for Base16 stylix are defined here.") + (defvar base16-stylix-theme-colors + '(:base00 "${base00}" + :base01 "${base01}" + :base02 "${base02}" + :base03 "${base03}" + :base04 "${base04}" + :base05 "${base05}" + :base06 "${base06}" + :base07 "${base07}" + :base08 "${base08}" + :base09 "${base09}" + :base0A "${base0A}" + :base0B "${base0B}" + :base0C "${base0C}" + :base0D "${base0D}" + :base0E "${base0E}" + :base0F "${base0F}") + "All colors for Base16 stylix are defined here.") - ;; Define the theme - (deftheme base16-stylix) + ;; Define the theme + (deftheme base16-stylix) - ;; Add all the faces to the theme - (base16-theme-define 'base16-stylix base16-stylix-theme-colors) + ;; Add all the faces to the theme + (base16-theme-define 'base16-stylix base16-stylix-theme-colors) - ;; Mark the theme as provided - (provide-theme 'base16-stylix) + ;; Mark the theme as provided + (provide-theme 'base16-stylix) - ;; Add path to theme to theme-path - (add-to-list 'custom-theme-load-path - (file-name-directory - (file-truename load-file-name))) + ;; Add path to theme to theme-path + (add-to-list 'custom-theme-load-path + (file-name-directory + (file-truename load-file-name))) - (provide 'base16-stylix-theme) - ''; - packageRequires = [ epkgs.base16-theme ]; - }) + (provide 'base16-stylix-theme) + ''; + packageRequires = [ epkgs.base16-theme ]; + } + )) ]; extraConfig = '' @@ -72,7 +72,7 @@ in (setq base16-theme-256-color-source 'colors) (load-theme 'base16-stylix t) ;; Set font - (set-face-attribute 'default nil :font (font-spec :family "${monospace.name}" :size ${emacsSize})) + (set-face-attribute 'default nil :font (font-spec :family "${fonts.monospace.name}" :size ${emacsSize})) ;; ----------------------------- ;; set opacity (add-to-list 'default-frame-alist '(alpha-background . ${emacsOpacity})) diff --git a/modules/foot/hm.nix b/modules/foot/hm.nix index b242bd10..66d0e47b 100644 --- a/modules/foot/hm.nix +++ b/modules/foot/hm.nix @@ -1,18 +1,14 @@ { config, lib, ... }: - let - cfg = config.stylix.targets.foot; - theme = config.lib.stylix.colors { templateRepo = config.stylix.inputs.tinted-foot; }; - in { options.stylix.targets.foot.enable = config.lib.stylix.mkEnableTarget "Foot" true; - config.programs.foot.settings = lib.mkIf cfg.enable { + config.programs.foot.settings = lib.mkIf config.stylix.targets.foot.enable { main = { include = theme; font = @@ -20,6 +16,6 @@ in "${monospace.name}:size=${toString sizes.terminal}"; dpi-aware = "no"; }; - colors.alpha = with config.stylix.opacity; terminal; + colors.alpha = config.stylix.opacity.terminal; }; } diff --git a/modules/fuzzel/hm.nix b/modules/fuzzel/hm.nix index af11b503..b141c761 100644 --- a/modules/fuzzel/hm.nix +++ b/modules/fuzzel/hm.nix @@ -1,10 +1,6 @@ { config, lib, ... }: - -with config.lib.stylix.colors; - let opacity = lib.toHexString (builtins.ceil (config.stylix.opacity.popups * 255)); - in { options.stylix.targets.fuzzel.enable = @@ -13,7 +9,7 @@ in config.programs.fuzzel.settings = lib.mkIf (config.stylix.enable && config.stylix.targets.fuzzel.enable) { - colors = { + colors = with config.lib.stylix.colors; { background = "${base00-hex}${opacity}"; text = "${base05-hex}ff"; placeholder = "${base03-hex}ff"; diff --git a/modules/grub/nixos.nix b/modules/grub/nixos.nix index e767516f..463c07e7 100644 --- a/modules/grub/nixos.nix +++ b/modules/grub/nixos.nix @@ -5,12 +5,9 @@ ... }: -with config.lib.stylix; -with config.stylix.fonts; -with config.lib.stylix.colors.withHashtag; - let cfg = config.stylix.targets.grub; + inherit (config.stylix) imageScalingMode fonts; # Grub requires fonts to be converted to "PFF2 format" # This function takes a font { name, package } and produces a .pf2 file mkGrubFont = @@ -28,11 +25,9 @@ let ) # Convert to .pf2 - ${pkgs.grub2}/bin/grub-mkfont $font --output $out --size ${toString sizes.applications} + ${pkgs.grub2}/bin/grub-mkfont $font --output $out --size ${toString fonts.sizes.applications} ''; - inherit (config.stylix) imageScalingMode; - image-scale = if imageScalingMode == "fill" then "crop" @@ -62,90 +57,94 @@ in ]; }) ]; - options.stylix.targets.grub = { - enable = config.lib.stylix.mkEnableTarget "GRUB" true; - useWallpaper = config.lib.stylix.mkEnableWallpaper "GRUB" false; + options.stylix.targets.grub = with config.lib.stylix; { + enable = mkEnableTarget "GRUB" true; + useWallpaper = mkEnableWallpaper "GRUB" false; }; - config.boot.loader.grub = lib.mkIf (config.stylix.enable && cfg.enable) { - backgroundColor = base00; - # Need to override the NixOS splash, this will match the background - splashImage = pixel "base00"; + config.boot.loader.grub = + with config.lib.stylix.colors.withHashtag; + with config.lib.stylix; + with config.stylix.fonts; + lib.mkIf (config.stylix.enable && cfg.enable) { + backgroundColor = base00; + # Need to override the NixOS splash, this will match the background + splashImage = pixel "base00"; - # This font will be used for the GRUB terminal - font = toString (mkGrubFont monospace); + # This font will be used for the GRUB terminal + font = toString (mkGrubFont fonts.monospace); - # TODO: Include OS icons - theme = - pkgs.runCommand "stylix-grub" - { - themeTxt = '' - desktop-image: "background.png" - desktop-image-scale-method: "${image-scale}" - desktop-color: "${base00}" + # TODO: Include OS icons + theme = + pkgs.runCommand "stylix-grub" + { + themeTxt = '' + desktop-image: "background.png" + desktop-image-scale-method: "${image-scale}" + desktop-color: "${base00}" - title-text: "" + title-text: "" - terminal-left: "10%" - terminal-top: "20%" - terminal-width: "80%" - terminal-height: "60%" + terminal-left: "10%" + terminal-top: "20%" + terminal-width: "80%" + terminal-height: "60%" - + progress_bar { - left = 25% - top = 80%+20 # 20 pixels below boot menu - width = 50% - height = 30 + + progress_bar { + left = 25% + top = 80%+20 # 20 pixels below boot menu + width = 50% + height = 30 - id = "__timeout__" - show_text = true - font = "${sansSerif.name}" - text = "@TIMEOUT_NOTIFICATION_MIDDLE@" + id = "__timeout__" + show_text = true + font = "${fonts.sansSerif.name}" + text = "@TIMEOUT_NOTIFICATION_MIDDLE@" - border_color = "${base00}" - bg_color = "${base00}" - fg_color = "${base0B}" - text_color = "${base05}" - } + border_color = "${base00}" + bg_color = "${base00}" + fg_color = "${base0B}" + text_color = "${base05}" + } - + boot_menu { - left = 25% - top = 20% - width = 50% - height = 60% - menu_pixmap_style = "background_*.png" + + boot_menu { + left = 25% + top = 20% + width = 50% + height = 60% + menu_pixmap_style = "background_*.png" - item_height = 40 - item_icon_space = 8 - item_spacing = 0 - item_padding = 0 - item_font = "${sansSerif.name}" - item_color = "${base05}" + item_height = 40 + item_icon_space = 8 + item_spacing = 0 + item_padding = 0 + item_font = "${fonts.sansSerif.name}" + item_color = "${base05}" - selected_item_color = "${base01}" - selected_item_pixmap_style = "selection_*.png" - } - ''; - passAsFile = [ "themeTxt" ]; - } - '' - mkdir $out - cp $themeTxtPath $out/theme.txt - - ${ - if - cfg.useWallpaper - # Make sure the background image is .png by asking to convert it - then - "${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png" - else - "cp ${pixel "base00"} $out/background.png" + selected_item_color = "${base01}" + selected_item_pixmap_style = "selection_*.png" + } + ''; + passAsFile = [ "themeTxt" ]; } + '' + mkdir $out + cp $themeTxtPath $out/theme.txt - cp ${pixel "base01"} $out/background_c.png - cp ${pixel "base0B"} $out/selection_c.png + ${ + if + cfg.useWallpaper + # Make sure the background image is .png by asking to convert it + then + "${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png" + else + "cp ${pixel "base00"} $out/background.png" + } - cp ${mkGrubFont sansSerif} $out/sans_serif.pf2 - ''; - }; + cp ${pixel "base01"} $out/background_c.png + cp ${pixel "base0B"} $out/selection_c.png + + cp ${mkGrubFont sansSerif} $out/sans_serif.pf2 + ''; + }; } diff --git a/modules/hyprlock/hm.nix b/modules/hyprlock/hm.nix index e1a23e6c..083ce28e 100644 --- a/modules/hyprlock/hm.nix +++ b/modules/hyprlock/hm.nix @@ -1,23 +1,20 @@ { config, lib, ... }: - -with config.lib.stylix; - let cfg = config.stylix.targets.hyprlock; in { - options.stylix.targets.hyprlock = { + options.stylix.targets.hyprlock = with config.lib.stylix; { enable = mkEnableTarget "Hyprlock" true; useWallpaper = mkEnableWallpaper "Hyprlock" true; }; config = lib.mkIf (config.stylix.enable && cfg.enable) { - programs.hyprlock.settings = { + programs.hyprlock.settings = with config.lib.stylix.colors; { background = { - color = "rgb(${colors.base00})"; + color = "rgb(${base00})"; path = lib.mkIf cfg.useWallpaper "${config.stylix.image}"; }; - input-field = with colors; { + input-field = { outer_color = "rgb(${base03})"; inner_color = "rgb(${base00})"; font_color = "rgb(${base05})"; diff --git a/modules/i3/hm.nix b/modules/i3/hm.nix index 794c8cd0..70643d38 100644 --- a/modules/i3/hm.nix +++ b/modules/i3/hm.nix @@ -1,13 +1,5 @@ { config, lib, ... }: - -with config.lib.stylix.colors.withHashtag; - let - text = base05; - urgent = base08; - focused = base0D; - unfocused = base03; - fonts = let inherit (config.stylix) fonts; @@ -16,89 +8,96 @@ let names = [ fonts.sansSerif.name ]; size = fonts.sizes.desktop * 1.0; }; - in { options.stylix.targets.i3.enable = config.lib.stylix.mkEnableTarget "i3" true; - config = lib.mkMerge [ - (lib.mkIf config.stylix.targets.i3.enable { - xsession.windowManager.i3.config = { - inherit fonts; + config = + with config.lib.stylix.colors.withHashtag; + let + text = base05; + urgent = base08; + focused = base0D; + unfocused = base03; + in + lib.mkMerge [ + (lib.mkIf config.stylix.targets.i3.enable { + xsession.windowManager.i3.config = { + inherit fonts; - colors = - let - background = base00; - indicator = base0B; - in - { - inherit background; - urgent = { - inherit background indicator text; - border = urgent; - childBorder = urgent; + colors = + let + background = base00; + indicator = base0B; + in + { + inherit background; + urgent = { + inherit background indicator text; + border = urgent; + childBorder = urgent; + }; + focused = { + inherit background indicator text; + border = focused; + childBorder = focused; + }; + focusedInactive = { + inherit background indicator text; + border = unfocused; + childBorder = unfocused; + }; + unfocused = { + inherit background indicator text; + border = unfocused; + childBorder = unfocused; + }; + placeholder = { + inherit background indicator text; + border = unfocused; + childBorder = unfocused; + }; }; - focused = { - inherit background indicator text; - border = focused; - childBorder = focused; - }; - focusedInactive = { - inherit background indicator text; - border = unfocused; - childBorder = unfocused; - }; - unfocused = { - inherit background indicator text; - border = unfocused; - childBorder = unfocused; - }; - placeholder = { - inherit background indicator text; - border = unfocused; - childBorder = unfocused; - }; - }; - # output."*".bg = "${config.stylix.image} fill"; - }; - }) + # output."*".bg = "${config.stylix.image} fill"; + }; + }) - { - # Merge this with your bar configuration using //config.lib.stylix.i3.bar - lib.stylix.i3.bar = { - inherit fonts; + { + # Merge this with your bar configuration using //config.lib.stylix.i3.bar + lib.stylix.i3.bar = { + inherit fonts; - colors = - let - background = base00; - border = background; - in - { - inherit background; - statusline = text; - separator = base03; - focusedWorkspace = { - inherit text background; - border = focused; + colors = + let + background = base00; + border = background; + in + { + inherit background; + statusline = text; + separator = base03; + focusedWorkspace = { + inherit text background; + border = focused; + }; + activeWorkspace = { + inherit border background; + text = focused; + }; + inactiveWorkspace = { + inherit text border background; + }; + urgentWorkspace = { + inherit text background; + border = urgent; + }; + bindingMode = { + inherit text border; + background = urgent; + }; }; - activeWorkspace = { - inherit border background; - text = focused; - }; - inactiveWorkspace = { - inherit text border background; - }; - urgentWorkspace = { - inherit text background; - border = urgent; - }; - bindingMode = { - inherit text border; - background = urgent; - }; - }; - }; - } - ]; + }; + } + ]; } diff --git a/modules/i3status-rust/hm.nix b/modules/i3status-rust/hm.nix index 47fbd727..ebac3328 100644 --- a/modules/i3status-rust/hm.nix +++ b/modules/i3status-rust/hm.nix @@ -1,22 +1,19 @@ -{ config, lib, ... }: - -let - colors = config.lib.stylix.colors.withHashtag; -in +{ config, ... }: { # Merge this with your bar's theme's overrides with //config.lib.stylix.i3status-rust.bar - config.lib.stylix.i3status-rust.bar = with colors; { - idle_bg = base00; - idle_fg = base05; - info_bg = base09; - info_fg = base00; - good_bg = base01; - good_fg = base05; - warning_bg = base0A; - warning_fg = base00; - critical_bg = base08; - critical_fg = base00; - separator_bg = base00; - separator_fg = base05; - }; + config.lib.stylix.i3status-rust.bar = + with config.lib.stylix.colors.withHashtag; { + idle_bg = base00; + idle_fg = base05; + info_bg = base09; + info_fg = base00; + good_bg = base01; + good_fg = base05; + warning_bg = base0A; + warning_fg = base00; + critical_bg = base08; + critical_fg = base00; + separator_bg = base00; + separator_fg = base05; + }; } diff --git a/modules/k9s/hm.nix b/modules/k9s/hm.nix index 0706ce33..127e9f3f 100644 --- a/modules/k9s/hm.nix +++ b/modules/k9s/hm.nix @@ -1,12 +1,9 @@ { config, lib, ... }: - -with config.lib.stylix.colors.withHashtag; - { options.stylix.targets.k9s.enable = config.lib.stylix.mkEnableTarget "k9s" true; config = lib.mkIf config.stylix.targets.k9s.enable { - programs.k9s.skins.skin = { + programs.k9s.skins.skin = with config.lib.stylix.colors.withHashtag; { k9s = { body = { fgColor = base05-hex; diff --git a/modules/kubecolor/hm.nix b/modules/kubecolor/hm.nix index 942eee0a..8a306130 100644 --- a/modules/kubecolor/hm.nix +++ b/modules/kubecolor/hm.nix @@ -7,66 +7,66 @@ programs.kubecolor.settings = { preset = if config.stylix.polarity == "either" then "" else "${config.stylix.polarity}"; - theme = { + theme = with config.lib.stylix.colors.withHashtag; { base = { - info = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; - primary = "fg=${config.lib.stylix.colors.withHashtag.base0E-hex}"; - secondary = "fg=${config.lib.stylix.colors.withHashtag.base0D-hex}"; - success = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}:bold"; - warning = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}:bold"; - danger = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; - muted = "fg=${config.lib.stylix.colors.withHashtag.base04-hex}"; - key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; + info = "fg=${base05-hex}"; + primary = "fg=${base0E-hex}"; + secondary = "fg=${base0D-hex}"; + success = "fg=${base0B-hex}:bold"; + warning = "fg=${base0A-hex}:bold"; + danger = "fg=${base08-hex}:bold"; + muted = "fg=${base04-hex}"; + key = "fg=${base07-hex}:bold"; }; - default = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; + default = "fg=${base05-hex}"; data = { - key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; - string = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; - true = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}:bold"; - false = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; - number = "fg=${config.lib.stylix.colors.withHashtag.base0E-hex}"; - null = "fg=${config.lib.stylix.colors.withHashtag.base04-hex}"; - quantity = "fg=${config.lib.stylix.colors.withHashtag.base0E-hex}"; - duration = "fg=${config.lib.stylix.colors.withHashtag.base09-hex}"; - durationfresh = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}"; + key = "fg=${base07-hex}:bold"; + string = "fg=${base05-hex}"; + true = "fg=${base0B-hex}:bold"; + false = "fg=${base08-hex}:bold"; + number = "fg=${base0E-hex}"; + null = "fg=${base04-hex}"; + quantity = "fg=${base0E-hex}"; + duration = "fg=${base09-hex}"; + durationfresh = "fg=${base0B-hex}"; ratio = { - zero = "fg=${config.lib.stylix.colors.withHashtag.base04-hex}"; - equal = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}"; - unequal = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}"; + zero = "fg=${base04-hex}"; + equal = "fg=${base0B-hex}"; + unequal = "fg=${base0A-hex}"; }; }; status = { - success = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}:bold"; - warning = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}:bold"; - error = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; + success = "fg=${base0B-hex}:bold"; + warning = "fg=${base0A-hex}:bold"; + error = "fg=${base08-hex}:bold"; }; table = { - header = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}:bold"; - columns = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; + header = "fg=${base05-hex}:bold"; + columns = "fg=${base05-hex}"; }; stderr = { - default = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; - error = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; + default = "fg=${base05-hex}"; + error = "fg=${base08-hex}:bold"; }; describe = { - key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; + key = "fg=${base07-hex}:bold"; }; apply = { - created = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}"; - configured = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}"; - unchanged = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; - dryrun = "fg=${config.lib.stylix.colors.withHashtag.base0D-hex}"; - fallback = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; + created = "fg=${base0B-hex}"; + configured = "fg=${base0A-hex}"; + unchanged = "fg=${base05-hex}"; + dryrun = "fg=${base0D-hex}"; + fallback = "fg=${base05-hex}"; }; explain = { - key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; - required = "fg=${config.lib.stylix.colors.withHashtag.base00-hex}:bold"; + key = "fg=${base07-hex}:bold"; + required = "fg=${base00-hex}:bold"; }; options = { - flag = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; + flag = "fg=${base07-hex}:bold"; }; version = { - key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; + key = "fg=${base07-hex}:bold"; }; }; }; diff --git a/modules/mako/hm.nix b/modules/mako/hm.nix index 2acbe1f3..54ca5e29 100644 --- a/modules/mako/hm.nix +++ b/modules/mako/hm.nix @@ -4,9 +4,6 @@ options, ... }: - -with config.lib.stylix.colors.withHashtag; -with config.stylix.fonts; let makoOpacity = lib.toHexString ( ((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100 @@ -19,25 +16,28 @@ in # Referenced https://github.com/stacyharper/base16-mako config = lib.optionalAttrs (options.services ? mako) ( lib.mkIf (config.stylix.enable && config.stylix.targets.mako.enable) { - services.mako = { - backgroundColor = base00 + makoOpacity; - borderColor = base0D; - textColor = base05; - progressColor = "over ${base02}"; - font = "${sansSerif.name} ${toString sizes.popups}"; - # I wish the mako hm module was like the dunst one - extraConfig = '' - [urgency=low] - background-color=${base00}${makoOpacity} - border-color=${base0D} - text-color=${base0A} + services.mako = + with config.lib.stylix.colors.withHashtag; + with config.stylix.fonts; + { + backgroundColor = base00 + makoOpacity; + borderColor = base0D; + textColor = base05; + progressColor = "over ${base02}"; + font = "${sansSerif.name} ${toString sizes.popups}"; + # I wish the mako hm module was like the dunst one + extraConfig = '' + [urgency=low] + background-color=${base00}${makoOpacity} + border-color=${base0D} + text-color=${base0A} - [urgency=high] - background-color=${base00}${makoOpacity} - border-color=${base0D} - text-color=${base08} - ''; - }; + [urgency=high] + background-color=${base00}${makoOpacity} + border-color=${base0D} + text-color=${base08} + ''; + }; } ); } diff --git a/modules/mangohud/hm.nix b/modules/mangohud/hm.nix index 53ee2880..ef78662e 100644 --- a/modules/mangohud/hm.nix +++ b/modules/mangohud/hm.nix @@ -1,8 +1,6 @@ { config, lib, ... }: - let inherit (config.stylix) fonts opacity; - inherit (config.lib.stylix) colors; in { options.stylix.targets.mangohud.enable = @@ -11,7 +9,7 @@ in config = lib.mkIf (config.stylix.enable && config.stylix.targets.mangohud.enable) { - programs.mangohud.settings = with colors; { + programs.mangohud.settings = with config.lib.stylix.colors; { font_size = fonts.sizes.applications; font_size_text = fonts.sizes.applications; background_alpha = opacity.popups; diff --git a/modules/ncspot/hm.nix b/modules/ncspot/hm.nix index 0a8cd319..66387bc4 100644 --- a/modules/ncspot/hm.nix +++ b/modules/ncspot/hm.nix @@ -7,32 +7,28 @@ config = lib.mkIf (config.stylix.enable && config.stylix.targets.ncspot.enable) { - programs.ncspot.settings = - let - colors = config.lib.stylix.colors.withHashtag; - in - { - theme = with colors; { - background = - if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00; - primary = base05; - secondary = base04; - title = base06; - playing = base0B; - playing_selected = base0B; - playing_bg = - if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00; - highlight = base05; - highlight_bg = base02; - error = base05; - error_bg = base08; - statusbar = base00; - statusbar_progress = base04; - statusbar_bg = base04; - cmdline = base02; - cmdline_bg = base05; - search_match = base05; - }; + programs.ncspot.settings = { + theme = with config.lib.stylix.colors.withHashtag; { + background = + if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00; + primary = base05; + secondary = base04; + title = base06; + playing = base0B; + playing_selected = base0B; + playing_bg = + if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00; + highlight = base05; + highlight_bg = base02; + error = base05; + error_bg = base08; + statusbar = base00; + statusbar_progress = base04; + statusbar_bg = base04; + cmdline = base02; + cmdline_bg = base05; + search_match = base05; }; + }; }; } diff --git a/modules/nixos-icons/nixos.nix b/modules/nixos-icons/nixos.nix index e2fc7214..e45d774c 100644 --- a/modules/nixos-icons/nixos.nix +++ b/modules/nixos-icons/nixos.nix @@ -4,9 +4,6 @@ lib, ... }: - -with config.lib.stylix.colors; - { options.stylix.targets.nixos-icons.enable = config.lib.stylix.mkEnableTarget "the NixOS logo" true; @@ -18,7 +15,7 @@ with config.lib.stylix.colors; nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: { src = pkgs.applyPatches { inherit (oldAttrs) src; - prePatch = '' + prePatch = with config.lib.stylix.colors; '' substituteInPlace logo/nix-snowflake-white.svg --replace-fail '#ffffff' '#${base05}' # Insert attribution comment after the XML prolog diff --git a/modules/nushell/hm.nix b/modules/nushell/hm.nix index a355b33f..d1345cb7 100644 --- a/modules/nushell/hm.nix +++ b/modules/nushell/hm.nix @@ -1,50 +1,47 @@ { config, lib, ... }: - -with config.lib.stylix.colors.withHashtag; - { options.stylix.targets.nushell.enable = config.lib.stylix.mkEnableTarget "Nushell" true; # Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming config.programs.nushell.extraConfig = - lib.mkIf (config.stylix.enable && config.stylix.targets.nushell.enable) - '' - $env.config.color_config = { - separator: "${base03}" - leading_trailing_space_bg: "${base04}" - header: "${base0B}" - date: "${base0E}" - filesize: "${base0D}" - row_index: "${base0C}" - bool: "${base08}" - int: "${base0B}" - duration: "${base08}" - range: "${base08}" - float: "${base08}" - string: "${base04}" - nothing: "${base08}" - binary: "${base08}" - cellpath: "${base08}" - hints: dark_gray + with config.lib.stylix.colors.withHashtag; + lib.mkIf (config.stylix.enable && config.stylix.targets.nushell.enable) '' + $env.config.color_config = { + separator: "${base03}" + leading_trailing_space_bg: "${base04}" + header: "${base0B}" + date: "${base0E}" + filesize: "${base0D}" + row_index: "${base0C}" + bool: "${base08}" + int: "${base0B}" + duration: "${base08}" + range: "${base08}" + float: "${base08}" + string: "${base04}" + nothing: "${base08}" + binary: "${base08}" + cellpath: "${base08}" + hints: dark_gray - shape_garbage: { fg: "${base07}" bg: "${base08}" } - shape_bool: "${base0D}" - shape_int: { fg: "${base0E}" attr: b } - shape_float: { fg: "${base0E}" attr: b } - shape_range: { fg: "${base0A}" attr: b } - shape_internalcall: { fg: "${base0C}" attr: b } - shape_external: "${base0C}" - shape_externalarg: { fg: "${base0B}" attr: b } - shape_literal: "${base0D}" - shape_operator: "${base0A}" - shape_signature: { fg: "${base0B}" attr: b } - shape_string: "${base0B}" - shape_filepath: "${base0D}" - shape_globpattern: { fg: "${base0D}" attr: b } - shape_variable: "${base0E}" - shape_flag: { fg: "${base0D}" attr: b } - shape_custom: { attr: b } - } - ''; + shape_garbage: { fg: "${base07}" bg: "${base08}" } + shape_bool: "${base0D}" + shape_int: { fg: "${base0E}" attr: b } + shape_float: { fg: "${base0E}" attr: b } + shape_range: { fg: "${base0A}" attr: b } + shape_internalcall: { fg: "${base0C}" attr: b } + shape_external: "${base0C}" + shape_externalarg: { fg: "${base0B}" attr: b } + shape_literal: "${base0D}" + shape_operator: "${base0A}" + shape_signature: { fg: "${base0B}" attr: b } + shape_string: "${base0B}" + shape_filepath: "${base0D}" + shape_globpattern: { fg: "${base0D}" attr: b } + shape_variable: "${base0E}" + shape_flag: { fg: "${base0D}" attr: b } + shape_custom: { attr: b } + } + ''; } diff --git a/modules/qutebrowser/hm.nix b/modules/qutebrowser/hm.nix index 618342d8..2b89cbe5 100644 --- a/modules/qutebrowser/hm.nix +++ b/modules/qutebrowser/hm.nix @@ -1,239 +1,223 @@ { config, lib, ... }: - -with config.lib.stylix.colors.withHashtag; -with config.stylix.fonts; - let - background = base00; - secondary-background = base01; - selection-background = base03; + colors = config.lib.stylix.colors.withHashtag; + background = colors.base00; + secondary-background = colors.base01; + selection-background = colors.base03; - foreground = base05; - inverted-foreground = base00; + foreground = colors.base05; + inverted-foreground = colors.base00; - error = base08; + error = colors.base08; - info = base0B; - secondary-info = base0C; + info = colors.base0B; + secondary-info = colors.base0C; - warning = base0E; + warning = colors.base0E; in { options.stylix.targets.qutebrowser.enable = config.lib.stylix.mkEnableTarget "Qutebrowser" true; config = - lib.mkIf (config.stylix.enable && config.stylix.targets.qutebrowser.enable) - { - programs.qutebrowser.settings = { - colors = { - completion = { - category = { - bg = background; - fg = info; + with config.stylix.fonts; + lib.mkIf (config.stylix.enable && config.stylix.targets.qutebrowser.enable) { + programs.qutebrowser.settings = { + colors = { + completion = { + category = { + bg = background; + fg = info; - border = { - bottom = background; - top = background; - }; + border = { + bottom = background; + top = background; + }; + }; + + even.bg = background; + fg = foreground; + + item.selected = { + bg = selection-background; + + border = { + bottom = selection-background; + top = selection-background; }; - even.bg = background; fg = foreground; - - item.selected = { - bg = selection-background; - - border = { - bottom = selection-background; - top = selection-background; - }; - - fg = foreground; - }; - - match.fg = info; - odd.bg = secondary-background; - - scrollbar = { - bg = background; - fg = foreground; - }; }; - contextmenu = { - disabled = { - bg = secondary-background; - fg = inverted-foreground; - }; + match.fg = info; + odd.bg = secondary-background; - menu = { - bg = background; - fg = foreground; - }; - - selected = { - bg = selection-background; - fg = foreground; - }; + scrollbar = { + bg = background; + fg = foreground; }; + }; - downloads = { - bar.bg = background; - - error = { - bg = error; - fg = inverted-foreground; - }; - - start = { - bg = info; - fg = inverted-foreground; - }; - - stop = { - bg = secondary-info; - fg = inverted-foreground; - }; - }; - - hints = { + contextmenu = { + disabled = { bg = secondary-background; - fg = foreground; - match.fg = info; + fg = inverted-foreground; }; - keyhint = { + menu = { bg = background; fg = foreground; - suffix.fg = foreground; }; - messages = { - error = { - bg = error; - fg = inverted-foreground; - border = error; - }; - - info = { - bg = info; - fg = inverted-foreground; - border = info; - }; - - warning = { - bg = warning; - fg = inverted-foreground; - border = warning; - }; - }; - - prompts = { - bg = background; - border = background; + selected = { + bg = selection-background; fg = foreground; - selected.bg = secondary-background; + }; + }; + + downloads = { + bar.bg = background; + + error = { + bg = error; + fg = inverted-foreground; }; - statusbar = { - caret = { + start = { + bg = info; + fg = inverted-foreground; + }; + + stop = { + bg = secondary-info; + fg = inverted-foreground; + }; + }; + + hints = { + bg = secondary-background; + fg = foreground; + match.fg = info; + }; + + keyhint = { + bg = background; + fg = foreground; + suffix.fg = foreground; + }; + + messages = { + error = { + bg = error; + fg = inverted-foreground; + border = error; + }; + + info = { + bg = info; + fg = inverted-foreground; + border = info; + }; + + warning = { + bg = warning; + fg = inverted-foreground; + border = warning; + }; + }; + + prompts = { + bg = background; + border = background; + fg = foreground; + selected.bg = secondary-background; + }; + + statusbar = { + caret = { + bg = selection-background; + fg = foreground; + + selection = { bg = selection-background; fg = foreground; - - selection = { - bg = selection-background; - fg = foreground; - }; }; + }; - command = { - bg = background; - fg = foreground; - - private = { - bg = secondary-background; - fg = foreground; - }; - }; - - insert = { - bg = info; - fg = inverted-foreground; - }; - - normal = { - bg = background; - fg = foreground; - }; - - passthrough = { - bg = secondary-info; - fg = inverted-foreground; - }; + command = { + bg = background; + fg = foreground; private = { bg = secondary-background; fg = foreground; }; - - progress.bg = info; - - url = { - error.fg = error; - fg = foreground; - hover.fg = foreground; - - success = { - http.fg = secondary-info; - https.fg = info; - }; - - warn.fg = warning; - }; }; - tabs = { - bar.bg = background; + insert = { + bg = info; + fg = inverted-foreground; + }; - even = { - bg = secondary-background; - fg = foreground; + normal = { + bg = background; + fg = foreground; + }; + + passthrough = { + bg = secondary-info; + fg = inverted-foreground; + }; + + private = { + bg = secondary-background; + fg = foreground; + }; + + progress.bg = info; + + url = { + error.fg = error; + fg = foreground; + hover.fg = foreground; + + success = { + http.fg = secondary-info; + https.fg = info; }; - indicator = { - inherit error; - start = secondary-info; - stop = info; + warn.fg = warning; + }; + }; + + tabs = { + bar.bg = background; + + even = { + bg = secondary-background; + fg = foreground; + }; + + indicator = { + inherit error; + start = secondary-info; + stop = info; + }; + + odd = { + bg = background; + fg = foreground; + }; + + pinned = { + even = { + bg = info; + fg = inverted-foreground; }; odd = { - bg = background; - fg = foreground; - }; - - pinned = { - even = { - bg = info; - fg = inverted-foreground; - }; - - odd = { - bg = secondary-info; - fg = inverted-foreground; - }; - - selected = { - even = { - bg = selection-background; - fg = foreground; - }; - - odd = { - bg = selection-background; - fg = foreground; - }; - }; + bg = secondary-info; + fg = inverted-foreground; }; selected = { @@ -249,38 +233,51 @@ in }; }; - webpage = - let - isDark = config.stylix.polarity == "dark"; - in - { - darkmode.enabled = lib.mkIf isDark (lib.mkDefault true); - - preferred_color_scheme = lib.mkIf isDark (lib.mkDefault config.stylix.polarity); - }; - }; - - fonts = { - default_family = sansSerif.name; - default_size = "${toString sizes.applications}pt"; - - web = { - family = { - cursive = serif.name; - fantasy = serif.name; - fixed = monospace.name; - sans_serif = sansSerif.name; - serif = serif.name; - standard = sansSerif.name; + selected = { + even = { + bg = selection-background; + fg = foreground; }; - # TODO: Use the pixel unit: - # https://github.com/danth/stylix/issues/251. - size.default = builtins.floor (sizes.applications * 4 / 3 + 0.5); + odd = { + bg = selection-background; + fg = foreground; + }; }; }; - hints.border = background; + webpage = + let + isDark = config.stylix.polarity == "dark"; + in + { + darkmode.enabled = lib.mkIf isDark (lib.mkDefault true); + + preferred_color_scheme = lib.mkIf isDark (lib.mkDefault config.stylix.polarity); + }; }; + + fonts = { + default_family = sansSerif.name; + default_size = "${toString sizes.applications}pt"; + + web = { + family = { + cursive = serif.name; + fantasy = serif.name; + fixed = monospace.name; + sans_serif = sansSerif.name; + serif = serif.name; + standard = sansSerif.name; + }; + + # TODO: Use the pixel unit: + # https://github.com/danth/stylix/issues/251. + size.default = builtins.floor (sizes.applications * 4 / 3 + 0.5); + }; + }; + + hints.border = background; }; + }; } diff --git a/modules/rio/hm.nix b/modules/rio/hm.nix index 499bb361..a0dfb581 100644 --- a/modules/rio/hm.nix +++ b/modules/rio/hm.nix @@ -5,9 +5,6 @@ lib, ... }: -let - colors = config.lib.stylix.colors.withHashtag; -in { options.stylix.targets.rio.enable = config.lib.stylix.mkEnableTarget "Rio" true; @@ -20,7 +17,7 @@ in size = sizes.terminal * 4.0 / 3.0; }; window.opacity = with config.stylix.opacity; terminal; - colors = with colors; { + colors = with config.lib.stylix.colors.withHashtag; { selection-background = base02; selection-foreground = base05; cursor = base05; diff --git a/modules/rofi/hm.nix b/modules/rofi/hm.nix index c7a2fc20..4175918e 100644 --- a/modules/rofi/hm.nix +++ b/modules/rofi/hm.nix @@ -1,7 +1,4 @@ { config, lib, ... }: - -with config.stylix.fonts; - let inherit (config.lib.formats.rasi) mkLiteral; mkRgba = @@ -24,7 +21,7 @@ in config = lib.mkIf (config.stylix.enable && config.stylix.targets.rofi.enable) { programs.rofi = { - font = "${monospace.name} ${toString sizes.popups}"; + font = with config.stylix.fonts; "${monospace.name} ${toString sizes.popups}"; theme = { "*" = { background = mkRgba rofiOpacity "base00"; diff --git a/modules/sway/hm.nix b/modules/sway/hm.nix index 02230944..0e6fe525 100644 --- a/modules/sway/hm.nix +++ b/modules/sway/hm.nix @@ -1,20 +1,11 @@ { config, lib, ... }: - -with config.lib.stylix.colors.withHashtag; - let cfg = config.stylix.targets.sway; - text = base05; - urgent = base08; - focused = base0D; - unfocused = base03; - fonts = { names = [ config.stylix.fonts.sansSerif.name ]; size = config.stylix.fonts.sizes.desktop + 0.0; }; - in { options.stylix.targets.sway = { @@ -22,89 +13,97 @@ in useWallpaper = config.lib.stylix.mkEnableWallpaper "Sway" true; }; - config = lib.mkMerge [ - (lib.mkIf (config.stylix.enable && cfg.enable) { - wayland.windowManager.sway.config = { - inherit fonts; + config = + with config.lib.stylix.colors.withHashtag; + let + text = base05; + urgent = base08; + focused = base0D; + unfocused = base03; + in + lib.mkMerge [ + (lib.mkIf (config.stylix.enable && cfg.enable) { + wayland.windowManager.sway.config = { + inherit fonts; - colors = - let - background = base00; - indicator = base0B; - in - { - inherit background; - urgent = { - inherit background indicator text; - border = urgent; - childBorder = urgent; + colors = + let + background = base00; + indicator = base0B; + in + { + inherit background; + urgent = { + inherit background indicator text; + border = urgent; + childBorder = urgent; + }; + focused = { + inherit background indicator text; + border = focused; + childBorder = focused; + }; + focusedInactive = { + inherit background indicator text; + border = unfocused; + childBorder = unfocused; + }; + unfocused = { + inherit background indicator text; + border = unfocused; + childBorder = unfocused; + }; + placeholder = { + inherit background indicator text; + border = unfocused; + childBorder = unfocused; + }; }; - focused = { - inherit background indicator text; - border = focused; - childBorder = focused; - }; - focusedInactive = { - inherit background indicator text; - border = unfocused; - childBorder = unfocused; - }; - unfocused = { - inherit background indicator text; - border = unfocused; - childBorder = unfocused; - }; - placeholder = { - inherit background indicator text; - border = unfocused; - childBorder = unfocused; - }; - }; - output."*".bg = - lib.mkIf cfg.useWallpaper "${config.stylix.image} ${config.stylix.imageScalingMode}"; - seat."*".xcursor_theme = lib.mkIf ( - config.stylix.cursor != null - ) ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}''; - }; - }) + output."*".bg = + lib.mkIf cfg.useWallpaper "${config.stylix.image} ${config.stylix.imageScalingMode}"; + seat."*".xcursor_theme = lib.mkIf ( + config.stylix.cursor != null + ) ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}''; + }; + }) - { - # Merge this with your bar configuration using //config.lib.stylix.sway.bar - lib.stylix.sway.bar = { - inherit fonts; + { + # Merge this with your bar configuration using //config.lib.stylix.sway.bar + lib.stylix.sway.bar = { + inherit fonts; - colors = - let - background = base01; - border = background; - in - { - inherit background; - statusline = text; - separator = base03; - focusedWorkspace = { - inherit text border; - background = focused; + colors = + let + background = base01; + border = background; + in + { + inherit background; + statusline = text; + separator = base03; + focusedWorkspace = { + inherit text border; + background = focused; + }; + activeWorkspace = { + inherit text border; + background = unfocused; + }; + inactiveWorkspace = { + inherit text border; + background = unfocused; + }; + urgentWorkspace = { + inherit text border; + background = urgent; + }; + bindingMode = { + inherit text border; + background = urgent; + }; }; - activeWorkspace = { - inherit text border; - background = unfocused; - }; - inactiveWorkspace = { - inherit text border; - background = unfocused; - }; - urgentWorkspace = { - inherit text border; - background = urgent; - }; - bindingMode = { - inherit text border; - background = urgent; - }; - }; - }; - } - ]; + }; + } + ]; } diff --git a/modules/swaylock/hm.nix b/modules/swaylock/hm.nix index d9278e3a..7f83de25 100644 --- a/modules/swaylock/hm.nix +++ b/modules/swaylock/hm.nix @@ -4,19 +4,8 @@ lib, ... }: - -with config.lib.stylix.colors; - let cfg = config.stylix.targets.swaylock; - - inside = base01-hex; - outside = base01-hex; - ring = base05-hex; - text = base05-hex; - positive = base0B-hex; - negative = base08-hex; - in { imports = [ @@ -65,6 +54,15 @@ in ) { programs.swaylock.settings = + with config.lib.stylix.colors; + let + inside = base01-hex; + outside = base01-hex; + ring = base05-hex; + text = base05-hex; + positive = base0B-hex; + negative = base08-hex; + in { color = outside; scaling = config.stylix.imageScalingMode; diff --git a/modules/swaync/hm.nix b/modules/swaync/hm.nix index 4433c920..4a6f828e 100644 --- a/modules/swaync/hm.nix +++ b/modules/swaync/hm.nix @@ -3,10 +3,6 @@ lib, ... }: - -with config.lib.stylix.colors.withHashtag; -with config.stylix.fonts; - { options.stylix.targets.swaync = { enable = config.lib.stylix.mkEnableTarget "SwayNC" true; @@ -16,6 +12,8 @@ with config.stylix.fonts; lib.mkIf (config.stylix.enable && config.stylix.targets.swaync.enable) { services.swaync.style = + with config.stylix.fonts; + with config.lib.stylix.colors.withHashtag; '' @define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03}; @define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07}; diff --git a/modules/tofi/hm.nix b/modules/tofi/hm.nix index fe056019..c0b6c1bf 100644 --- a/modules/tofi/hm.nix +++ b/modules/tofi/hm.nix @@ -3,14 +3,14 @@ lib, ... }: -with config.stylix.fonts; -with config.lib.stylix.colors.withHashtag; { options.stylix.targets.tofi.enable = config.lib.stylix.mkEnableTarget "Tofi" true; config = lib.mkIf (config.stylix.enable && config.stylix.targets.tofi.enable) { programs.tofi.settings = + with config.stylix.fonts; + with config.lib.stylix.colors.withHashtag; let opacity = lib.toHexString ( ((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100 diff --git a/modules/vscode/hm.nix b/modules/vscode/hm.nix index c67518f9..c3b41e96 100644 --- a/modules/vscode/hm.nix +++ b/modules/vscode/hm.nix @@ -5,8 +5,6 @@ ... }@args: -with config.stylix.fonts; - let extension = pkgs.runCommandLocal "stylix-vscode" diff --git a/modules/wezterm/hm.nix b/modules/wezterm/hm.nix index c5a45027..5a915e88 100644 --- a/modules/wezterm/hm.nix +++ b/modules/wezterm/hm.nix @@ -1,13 +1,10 @@ { config, lib, ... }: - -let - colors = config.lib.stylix.colors.withHashtag; -in { options.stylix.targets.wezterm.enable = config.lib.stylix.mkEnableTarget "wezterm" true; config = + with config.lib.stylix.colors.withHashtag; lib.mkIf ( config.stylix.enable @@ -15,8 +12,7 @@ in && config.programs.wezterm.enable ) { - - programs.wezterm.colorSchemes.stylix = with colors; { + programs.wezterm.colorSchemes.stylix = { ansi = [ base00 base08 @@ -74,7 +70,6 @@ in }; xdg.configFile."wezterm/wezterm.lua".text = - with colors; with config.stylix.fonts; lib.mkForce '' -- Generated by Stylix diff --git a/modules/wofi/hm.nix b/modules/wofi/hm.nix index 1db9114c..70adae68 100644 --- a/modules/wofi/hm.nix +++ b/modules/wofi/hm.nix @@ -3,45 +3,44 @@ lib, ... }: -with config.stylix.fonts; -let - colors = config.lib.stylix.colors.withHashtag; -in { options.stylix.targets.wofi.enable = config.lib.stylix.mkEnableTarget "wofi" config.programs.wofi.enable; config = lib.mkIf (config.stylix.enable && config.stylix.targets.wofi.enable) { - programs.wofi.style = with colors; '' - window { - font-family: "${monospace.name}"; - font-size: ${toString sizes.popups}pt; + programs.wofi.style = + with config.lib.stylix.colors.withHashtag; + with config.stylix.fonts; + '' + window { + font-family: "${monospace.name}"; + font-size: ${toString sizes.popups}pt; - background-color: ${base00}; - color: ${base05}; - } + background-color: ${base00}; + color: ${base05}; + } - #entry:nth-child(odd) { - background-color: ${base00}; - } + #entry:nth-child(odd) { + background-color: ${base00}; + } - #entry:nth-child(even) { - background-color: ${base01}; - } + #entry:nth-child(even) { + background-color: ${base01}; + } - #entry:selected { - background-color: ${base02}; - } + #entry:selected { + background-color: ${base02}; + } - #input { - background-color: ${base01}; - color: ${base04}; - border-color: ${base02}; - } + #input { + background-color: ${base01}; + color: ${base04}; + border-color: ${base02}; + } - #input:focus { - border-color: ${base0A}; - } - ''; + #input:focus { + border-color: ${base0A}; + } + ''; }; }