From a31591529804f3428e9d14117e2eac1ac7f1405d Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Fri, 17 Jan 2025 12:02:58 +0100 Subject: [PATCH] treewide: move hyprlock styling out of module --- modules/hm/programs/hypr/lock.nix | 102 ++++++++++++++++++++++- modules/nix/style/modules/hyprlock.nix | 109 ------------------------- 2 files changed, 101 insertions(+), 110 deletions(-) delete mode 100644 modules/nix/style/modules/hyprlock.nix diff --git a/modules/hm/programs/hypr/lock.nix b/modules/hm/programs/hypr/lock.nix index 477c7b0..b7f09e7 100644 --- a/modules/hm/programs/hypr/lock.nix +++ b/modules/hm/programs/hypr/lock.nix @@ -1,14 +1,114 @@ { lib, + lib', inputs, pkgs, osConfig, ... -}: { +}: let + styleCfg = osConfig.local.style; + rgbaPalette = builtins.mapAttrs (_: c: (lib'.rgba c 1)) styleCfg.scheme.palette; +in { config = lib.mkIf osConfig.local.modules.hyprland.enable { programs.hyprlock = { enable = true; package = inputs.hyprlock.packages.${pkgs.system}.hyprlock; + + settings = lib.mkMerge [ + { + general = { + disable_loading_bar = true; + hide_cursor = true; + }; + } + + (with rgbaPalette; + lib.mkIf styleCfg.enable { + background = [ + { + path = "screenshot"; + blur_passes = 3; + blur_size = 8; + } + ]; + + label = [ + { + monitor = ""; + text = "Layout: $LAYOUT"; + font_size = 25; + color = base05; + + position = "30, -30"; + halign = "left"; + valign = "top"; + } + { + monitor = ""; + text = "$TIME"; + font_size = 90; + color = base05; + + position = "-30, 0"; + halign = "right"; + valign = "top"; + } + { + monitor = ""; + text = "cmd[update:43200000] date +\"%A, %d %B %Y\""; + font_size = 25; + color = base05; + + position = "-30, -150"; + halign = "right"; + valign = "top"; + } + ]; + + image = { + monitor = ""; + path = "${styleCfg.avatar}"; # Replace with your avatar path + size = 100; + border_color = base0D; + + position = "0, 75"; + halign = "center"; + valign = "center"; + }; + + input-field = [ + { + monitor = ""; + + size = "300, 60"; + outline_thickness = 4; + dots_size = 0.2; + dots_spacing = 0.2; + dots_center = true; + + outer_color = base0D; + inner_color = base02; + font_color = base05; + + fade_on_empty = false; + + # the span elements still use #RRGGBB, so we use scheme directly + placeholder_text = "󰌾 Logged in as $USER"; + + hide_input = false; + check_color = base0D; + fail_color = base08; + + fail_text = "$FAIL ($ATTEMPTS)"; + capslock_color = base0E; + + position = "0, -47"; + halign = "center"; + valign = "center"; + } + ]; + }) + ]; }; }; } diff --git a/modules/nix/style/modules/hyprlock.nix b/modules/nix/style/modules/hyprlock.nix deleted file mode 100644 index 7d9dddc..0000000 --- a/modules/nix/style/modules/hyprlock.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ - lib, - lib', - config, - ... -}: let - cfg = config.local.style; - - # hyprlock takes colors such as rgb[a](r, g, b [, a]) - rgbaPalette = builtins.mapAttrs (_: c: (lib'.rgba c 1)) cfg.scheme.palette; -in { - config.home-manager.sharedModules = with rgbaPalette; - lib.mkIf cfg.enable [ - { - programs.hyprlock = { - settings = { - background = [ - { - path = "screenshot"; - blur_passes = 3; - blur_size = 8; - } - ]; - - general = { - disable_loading_bar = true; - hide_cursor = true; - }; - - label = [ - { - monitor = ""; - text = "Layout: $LAYOUT"; - font_size = 25; - color = base05; - - position = "30, -30"; - halign = "left"; - valign = "top"; - } - { - monitor = ""; - text = "$TIME"; - font_size = 90; - color = base05; - - position = "-30, 0"; - halign = "right"; - valign = "top"; - } - { - monitor = ""; - text = "cmd[update:43200000] date +\"%A, %d %B %Y\""; - font_size = 25; - color = base05; - - position = "-30, -150"; - halign = "right"; - valign = "top"; - } - ]; - - image = { - monitor = ""; - path = "${cfg.avatar}"; # Replace with your avatar path - size = 100; - border_color = base0D; - - position = "0, 75"; - halign = "center"; - valign = "center"; - }; - - input-field = [ - { - monitor = ""; - - size = "300, 60"; - outline_thickness = 4; - dots_size = 0.2; - dots_spacing = 0.2; - dots_center = true; - - outer_color = base0D; - inner_color = base02; - font_color = base05; - - fade_on_empty = false; - - # the span elements still use #RRGGBB, so we use scheme directly - placeholder_text = "󰌾 Logged in as $USER"; - - hide_input = false; - check_color = base0D; - fail_color = base08; - - fail_text = "$FAIL ($ATTEMPTS)"; - capslock_color = base0E; - - position = "0, -47"; - halign = "center"; - valign = "center"; - } - ]; - }; - }; - } - ]; -}