nix-dotfiles/modules/desktop/hyprlock.nix
2025-01-28 21:28:00 -08:00

124 lines
4 KiB
Nix

{ lib, config, pkgs, inputs, system, ... }:
with lib;
let
cfg = config.modules.desktop.hyprlock;
in {
options.modules.desktop.hyprlock = {
enable = mkEnableOption "Enable hyprlock, a simple, fast, multithreaded screen lock for hyprland";
package = mkOption {
type = types.package;
default = inputs.hyprlock.packages.${system}.hyprlock;
example = "pkgs.hyprlock";
};
};
config = mkIf cfg.enable {
security.pam.services.hyprlock.text = "auth include login";
hm.home.packages = with pkgs; [ cfg.package wlinhibit ];
hm.programs.hyprlock = {
enable = true;
package = cfg.package;
settings = with config.colorScheme.palette; {
general = {
hide_cursor = false;
no_fade_in = true;
no_fade_out = true;
text_trim = true;
# this will render the color we specified on the background before the image is loaded
# i like this because we will no longer see our screen for a split second before the image is ready
# extra security feature too
immediate_render = true;
};
background = [
{
path = toString ../../assets/lockscreen.jpg;
color = "rgb(${base00})";
blur_passes = 3;
blur_size = 6;
}
];
shape = [
{
size = "280, 280";
color = "rgb(${base00})";
rounding = 48;
position = "0, 45";
halign = "center"; valign = "center";
shadow_passes = 3;
shadow_size = 8;
}
];
label = [
{
position = "0, 105";
text = "cmd[update:1000] echo \"<span font_weight='1000'>$(date +'%H')</span>\"";
font_size = 78;
# TODO: make more dynamic
color = "rgb(f5c2e7)"; # catppuccin pink
font_family = config.modules.desktop.fonts.fonts.sansSerif.family;
halign = "center"; valign = "center";
}
{
position = "0, 20";
text = "cmd[update:1000] echo \"<span font_weight='1000'>$(date +'%M')</span>\"";
font_size = 78;
color = "rgb(${base05})";
font_family = config.modules.desktop.fonts.fonts.sansSerif.family;
halign = "center"; valign = "center";
}
{
position = "0, -45";
text = "cmd[update:1000] echo \"$(date +'%A, %d %B')\"";
font_size = 14;
color = "rgb(${base05})";
font_family = config.modules.desktop.fonts.fonts.sansSerif.family;
halign = "center"; valign = "center";
}
{
position = "-15, -11";
halign = "right"; valign = "top";
color = "rgb(${base05})";
font_size = 14;
font_family = "Font Awesome 6 Free";
text = "cmd[update:4000] echo \"$(${lib.getExe pkgs.acpi} | grep -q \"Battery\" && echo \"\")\"";
shadow_passes = 3;
shadow_size = 8;
}
{
position = "-41, -10";
halign = "right"; valign = "top";
color = "rgb(${base05})";
font_size = 14;
font_family = config.modules.desktop.fonts.fonts.sansSerif.family;
text = "cmd[update:4000] echo \"<b>$(${lib.getExe pkgs.acpi} -b | grep -oP \"\\d+%\" | head -n 1)</b>\"";
shadow_passes = 3;
shadow_size = 8;
}
];
input-field = [
{
position = "0, -140";
size = "280, 48";
outline_thickness = 2;
dots_size = 0.3;
fade_on_empty = false;
placeholder_text = "";
outer_color = "rgb(${base00})";
inner_color = "rgb(${base00})";
font_color = "rgb(${base05})";
check_color = "rgb(${base02})";
fail_color = "rgb(${base08})";
capslock_color = "rgb(${base09})";
}
];
};
};
};
}