From d8d1e08400acfeb516b7846c4e394567ecf23ec0 Mon Sep 17 00:00:00 2001
From: punkfairie <marley@punkfairie.net>
Date: Mon, 13 Jan 2025 20:31:44 -0800
Subject: [PATCH] feat: Hyprlock

---
 modules/home/programs/hyprlock/default.nix  | 49 +++++++++++++++++++++
 modules/home/programs/wlogout/default.nix   |  2 +
 modules/home/wayland/hyprland/default.nix   |  1 +
 modules/nixos/programs/hyprlock/default.nix | 15 +++++++
 modules/nixos/wayland/hyprland/default.nix  |  2 +
 5 files changed, 69 insertions(+)
 create mode 100644 modules/home/programs/hyprlock/default.nix
 create mode 100644 modules/nixos/programs/hyprlock/default.nix

diff --git a/modules/home/programs/hyprlock/default.nix b/modules/home/programs/hyprlock/default.nix
new file mode 100644
index 0000000..2da8ff2
--- /dev/null
+++ b/modules/home/programs/hyprlock/default.nix
@@ -0,0 +1,49 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  cfg = config.marleyos.programs.hyprlock;
+in {
+  options.marleyos.programs.hyprlock.enable = lib.mkEnableOption "hyprlock";
+
+  config = lib.mkIf cfg.enable {
+    programs.hyprlock = {
+      enable = true;
+
+      settings = {
+        general = {
+          disable_loading_bar = true;
+          grace = 10;
+          hide_cursor = true;
+          no_fade_in = false;
+        };
+
+        background = [
+          {
+            path = "${../../wayland/hyprland/wallpaper.png}";
+            blur_passes = 3;
+            blur_size = 8;
+          }
+        ];
+
+        input-field = [
+          {
+            size = "200, 50";
+            position = "0, -80";
+            monitor = "";
+            dots_center = true;
+            fade_on_empty = false;
+            # FIXME: Don't hardcode these.
+            font_color = "rgb(191724)";
+            inner_color = "rgb(ebbcba)";
+            outer_color = "rgb(191724)";
+            outline_thickness = 5;
+            placeholder_text = "password...";
+            shadow_passes = 2;
+          }
+        ];
+      };
+    };
+  };
+}
diff --git a/modules/home/programs/wlogout/default.nix b/modules/home/programs/wlogout/default.nix
index 5ed9434..025f0c2 100644
--- a/modules/home/programs/wlogout/default.nix
+++ b/modules/home/programs/wlogout/default.nix
@@ -9,6 +9,8 @@ in {
   options.marleyos.programs.wlogout.enable = lib.mkEnableOption "wlogout";
 
   config = lib.mkIf cfg.enable {
+    marleyos.programs.hyprlock.enable = true;
+
     programs.wlogout = {
       enable = true;
 
diff --git a/modules/home/wayland/hyprland/default.nix b/modules/home/wayland/hyprland/default.nix
index 67730ad..281e64d 100644
--- a/modules/home/wayland/hyprland/default.nix
+++ b/modules/home/wayland/hyprland/default.nix
@@ -37,6 +37,7 @@ in {
 
     marleyos = {
       programs = {
+        hyprlock.enable = true;
         waybar.enable = true;
         wlogout.enable = true;
         wofi.enable = true;
diff --git a/modules/nixos/programs/hyprlock/default.nix b/modules/nixos/programs/hyprlock/default.nix
new file mode 100644
index 0000000..8fb261b
--- /dev/null
+++ b/modules/nixos/programs/hyprlock/default.nix
@@ -0,0 +1,15 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  cfg = config.marleyos.programs.hyprlock;
+in {
+  options.marleyos.programs.hyprlock.enable = lib.mkEnableOption "hyprlock";
+
+  config = lib.mkIf cfg.enable {
+    programs.hyprlock = {
+      enable = true;
+    };
+  };
+}
diff --git a/modules/nixos/wayland/hyprland/default.nix b/modules/nixos/wayland/hyprland/default.nix
index d242ad7..c532638 100644
--- a/modules/nixos/wayland/hyprland/default.nix
+++ b/modules/nixos/wayland/hyprland/default.nix
@@ -10,6 +10,8 @@ in {
   options.marleyos.wayland.hyprland.enable = mkEnableOption "hyprland";
 
   config = mkIf cfg.enable {
+    marleyos.programs.hyprlock.enable = true;
+
     programs.hyprland = {
       enable = true;
       withUWSM = false;