diff --git a/modules/desktop/wm/gtklock.nix b/modules/desktop/wm/gtklock.nix deleted file mode 100644 index 85fecab..0000000 --- a/modules/desktop/wm/gtklock.nix +++ /dev/null @@ -1,213 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit (config.lib.stylix) colors; - - background = - pkgs.runCommand "lock-background.jpg" { nativeBuildInputs = [ pkgs.buildPackages.imagemagick ]; } - '' - magick ${../../../background.jpg} -resize 50% -blur 0x16 -modulate 80 $out - ''; - - layout = pkgs.writeText "gtklock.ui" '' - - - - window-box - - external - never - - - none - - - content-box - center - center - vertical - - - info-box - vertical - - - time-box - vertical - - - clock-label - - - - - date-label - - - - - - - - - none - - - center - 8 - - - 1 - - - - - input-field - 300 - 0.5 - 0 - 0 - password - Input Password - - - - 0 - 0 - - - - - none - 1 - - - never - 256 - 1 - - - - - vertical - 1 - - - - - - - - - 0 - 1 - - - - - center - vertical - - - error-label - 1 - center - - - - - warning-label - 1 - center - - - - - 1 - - - - - - 0 - 2 - - - - - - - - - - - - - ''; -in -{ - options.quad.lock = lib.mkOption { - type = lib.types.package; - readOnly = true; - description = "Locks the session with gtklock, unless it's already running."; - default = pkgs.writeShellScript "lock" '' - exec ${lib.getExe' pkgs.util-linux "flock"} --nonblock "$XDG_RUNTIME_DIR/gtklock.lock" \ - ${lib.getExe' config.systemd.package "systemd-cat"} --identifier=gtklock \ - ${lib.getExe config.programs.gtklock.package} - ''; - }; - - config.programs.gtklock = { - enable = true; - - config.main = { - layout = "${layout}"; - time-format = "%H:%M"; - date-format = "%A, %B %-d"; - }; - - style = '' - window { - background-image: url("${background}"); - background-size: cover; - background-position: center; - } - - #window-box, - #window-box viewport { - background: none; - } - - #clock-label { - font-size: 96pt; - color: white; - } - - #date-label { - font-size: 20pt; - color: white; - margin-bottom: 80px; - } - - #input-field { - min-height: 50px; - padding: 0 20px; - border: none; - border-radius: 25px; - box-shadow: none; - background: #${colors.base01}; - color: #${colors.base05}; - } - - #error-label, - #warning-label { - color: #${colors.base08}; - } - ''; - }; -} diff --git a/modules/desktop/wm/hyprlock.nix b/modules/desktop/wm/hyprlock.nix new file mode 100644 index 0000000..2471ce6 --- /dev/null +++ b/modules/desktop/wm/hyprlock.nix @@ -0,0 +1,60 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (config.lib.stylix) colors; + + hyprlockConfig = pkgs.writeText "hyprlock.conf" '' + auth { + fingerprint { + enabled = ${lib.boolToString config.services.fprintd.enable} + ready_message = Scan fingerprint to unlock + present_message = Scanning... + } + } + + background { + path = screenshot + blur_passes = 3 + } + + label { + text = $TIME + font_size = 96 + position = 0, 200 + } + + label { + text = cmd[update:60000] date +"%A, %B %-d" + font_size = 20 + position = 0, 110 + } + + input-field { + size = 300, 50 + outline_thickness = 0 + inner_color = rgb(${colors.base01}) + font_color = rgb(${colors.base05}) + check_color = rgb(${colors.base0D}) + fade_on_empty = false + ${lib.optionalString config.services.fprintd.enable "placeholder_text = $FPRINTPROMPT"} + } + ''; +in +{ + options.quad.lock = lib.mkOption { + type = lib.types.package; + readOnly = true; + description = "Locks the session with hyprlock, unless it's already running."; + default = pkgs.writeShellScript "lock" '' + exec ${lib.getExe' pkgs.util-linux "flock"} --nonblock "$XDG_RUNTIME_DIR/hyprlock.lock" \ + ${lib.getExe' config.systemd.package "systemd-cat"} --identifier=hyprlock \ + ${lib.getExe pkgs.hyprlock} --config ${hyprlockConfig} + ''; + }; + + config.security.pam.services.hyprlock.fprintAuth = false; +}