From 7be8e612c3c38bf987aa72b8811175164194c705 Mon Sep 17 00:00:00 2001 From: ooks-io Date: Tue, 29 Oct 2024 16:41:59 +1100 Subject: [PATCH] hyprland: fix hypridle/hyprlock --- .../hyprland/components/hypridle.nix | 14 ++- .../hyprland/components/hyprlock.nix | 88 ++++++++----------- 2 files changed, 47 insertions(+), 55 deletions(-) diff --git a/modules/home/workstation/hyprland/components/hypridle.nix b/modules/home/workstation/hyprland/components/hypridle.nix index dc2976d..00e0470 100644 --- a/modules/home/workstation/hyprland/components/hypridle.nix +++ b/modules/home/workstation/hyprland/components/hypridle.nix @@ -1,13 +1,16 @@ { inputs', + pkgs, osConfig, lib, config, ... }: let - inherit (lib) getExe mkIf; + inherit (lib) getExe getExe' mkIf; inherit (osConfig.ooknet.workstation) environment; + dpms = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms"; + lock = "${getExe' pkgs.systemd "loginctl"} lock-session"; hyprlock = getExe config.programs.hyprlock.package; in { config = mkIf (environment == "hyprland") { @@ -17,13 +20,18 @@ in { settings = { general = { lock_cmd = hyprlock; - ignore_dbus_inhibit = false; + before_sleep_cmd = lock; }; listener = [ { - timout = 300; + timeout = 300; on-timeout = hyprlock; } + { + timeout = 360; + on-timeout = "${dpms} off"; + on-resume = "${dpms} on"; + } ]; }; }; diff --git a/modules/home/workstation/hyprland/components/hyprlock.nix b/modules/home/workstation/hyprland/components/hyprlock.nix index fe71b0c..a829f9b 100644 --- a/modules/home/workstation/hyprland/components/hyprlock.nix +++ b/modules/home/workstation/hyprland/components/hyprlock.nix @@ -10,69 +10,53 @@ inherit (lib) mkIf; in { config = mkIf (environment == "hyprland") { - ooknet.binds.lock = "hyprlock"; + ooknet.binds.lock = "loginctl lock-session"; programs.hyprlock = { enable = true; - package = inputs'.hyprlock.packages.hyprlock; + package = inputs'.hyprlock.packages.default; settings = { enable = true; + general = { disable_loading_bar = true; hide_cursor = true; no_fade_in = true; + no_fade_out = true; + }; + + background = { + monitor = ""; + path = ""; + color = "0xff${palette.base01}"; + }; + + input-field = { + size = "200, 30"; + + position = "0, 0"; + outline_thickness = 2; + dots_spacing = 0.3; + dots_rounding = 0; + rounding = 0; + fade_on_empty = false; + placeholder_text = ""; + outer_color = "0xff${palette.base03}"; + inner_color = "0xff${palette.base00}"; + font_color = "0xff${palette.base05}"; + }; + + label = { + monitor = ""; + text = " LOCKED"; + position = "0, 150"; + valign = "center"; + halign = "center"; + color = "0xff${palette.base08}"; + font_size = 30; + font_family = "${fonts.monospace.family}"; }; - backgrounds = [ - { - monitor = ""; - path = ""; - color = "0xff${palette.base01}"; - } - ]; - input-fields = [ - { - size = { - width = 300; - height = 40; - }; - position = { - x = 0; - y = 0; - }; - outline_thickness = 2; - dots_spacing = 0.2; - fade_on_empty = false; - placeholder_text = ""; - outer_color = "0xff${palette.base02}"; - inner_color = "0xff${palette.base00}"; - font_color = "0xff${palette.base05}"; - } - ]; - labels = [ - { - monitor = ""; - text = "  "; - position = { - x = 0; - y = 80; - }; - color = "0xff${palette.base08}"; - font_size = 30; - font_family = "${fonts.monospace.family}"; - } - { - monitor = ""; - text = "$TIME"; - position = { - x = 0; - y = -80; - }; - color = "0xff${palette.base0B}"; - font_size = 20; - font_family = "${fonts.monospace.family}"; - } - ]; }; }; };