summaryrefslogtreecommitdiff
path: root/home/apps/hyprlock.nix
blob: 6a0119f53a5b043c686c4254ebcf96af737ad033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{
  config,
  lib,
  ...
}: let
  text = "rgb(${config.theme.colors.text})";
  base = "rgb(${config.theme.colors.base})";
  error = "rgb(${config.theme.colors.error})";
  trans = "rgba(0,0,0,0)";

  inherit (lib) mkIf optionals;
  cfg = config.apps.hyprlock;
in {
  config = mkIf cfg.enable {
    default.lockScreen = lib.mkDefault "hyprlock";

    programs.hyprlock = {
      enable = true;

      settings = {
        auth = {
          "pam:enabled" = true;
          "fingerprint:enabled" = config.fingerprint;
        };

        animations = {
          enabled = true;
          animation = [
            "fadeIn, 0"
            "fadeOut, 0"
          ];
        };

        background = {
          path = config.theme.lockscreen;
          color = base;
          blur_passes = 0;
          blur_size = 2;
          noise = 0;
          contrast = 0;
          brightness = 0;
          vibrancy = 0;
          vibrancy_darkness = 0.0;
        };

        # Password Input
        input-field = {
          size = "300, 50";
          outline_thickness = 0;
          dots_size = 0.25;
          dots_spacing = 0.55;
          dots_center = true;
          dots_rounding = -1;
          outer_color = trans;
          inner_color = trans;
          font_color = text;
          fade_on_empty = false;
          placeholder_text =
            "Enter Password"
            + (
              if config.fingerprint
              then " or Touch Fingerprint"
              else ""
            );
          hide_input = false;
          check_color = error;
          fail_color = error;
          capslock_color = trans;
          numlock_color = trans;
          bothlock_color = trans;
          invert_numlock = false;
          swap_font_color = false;
          font_family = config.theme.font.regular;
          position = "0, 50";
          halign = "center";
          valign = "bottom";
        };

        label = [
          # Date
          {
            text = "cmd[update:1000] echo \"$(date +\"%A, %B %d\")\"";
            color = text;
            font_size = 20;
            font_family = config.theme.font.header;
            position = "0, -100";
            halign = "center";
            valign = "top";
          }
          # Clock
          {
            text = "cmd[update:1000] echo \"$(date +\"%k:%M:%S\")\"";
            color = text;
            font_size = 90;
            font_family = config.theme.font.header;
            position = "0, -130";
            halign = "center";
            valign = "top";
          }
        ];
      };
    };
  };
}