From 3686a64a29a1e4be2a4aaee84970f1ae64aef6b2 Mon Sep 17 00:00:00 2001 From: NullBite Date: Tue, 20 Feb 2024 09:26:50 +0100 Subject: [PATCH] Hyprland: add lock screen --- home/common/wm.nix | 5 +++++ home/sessions/hyprland/default.nix | 8 ++++++++ system/common/wm.nix | 1 + 3 files changed, 14 insertions(+) diff --git a/home/common/wm.nix b/home/common/wm.nix index 4f55873..ddc38aa 100644 --- a/home/common/wm.nix +++ b/home/common/wm.nix @@ -10,6 +10,11 @@ in config = lib.mkIf cfg.enable { # Common options for standalone window managers; many of these (or # alternatives thereof) are pulled in by desktop environments. + programs = { + swaylock = { + enable = true; + }; + }; services = { udiskie = { enable = mkDefault true; diff --git a/home/sessions/hyprland/default.nix b/home/sessions/hyprland/default.nix index d1c3cf5..8b824f9 100644 --- a/home/sessions/hyprland/default.nix +++ b/home/sessions/hyprland/default.nix @@ -4,6 +4,7 @@ let mkd = lib.mkDefault; hyprland-pkg = config.wayland.windowManager.hyprland.finalPackage; + # commands terminal = "${pkgs.kitty}/bin/kitty"; files = "${pkgs.dolphin}/bin/dolphin"; rofi = "${pkgs.rofi-wayland}/bin/rofi"; @@ -11,6 +12,12 @@ let brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl"; polkit-agent = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"; grimblast = "${inputs.hyprwm-contrib.packages.${pkgs.system}.grimblast}/bin/grimblast"; + swayidle = "${pkgs.swayidle}/bin/swayidle"; + swaylock = "${pkgs.swaylock}/bin/swaylock"; + hyprctl = "${hyprland-pkg}/bin/hyprctl"; + + lock-cmd = "${swaylock}"; + idle-cmd = "${swayidle} -w timeout 300 '${hyprctl} dispatch dpms off' timeout 315 '${lock-cmd}' resume '${hyprctl} dispatch dpms on'"; hypr-dispatcher-package = pkgs.callPackage ./dispatcher { hyprland = hyprland-pkg; }; hypr-dispatcher = "${hypr-dispatcher-package}/bin/hypr-dispatcher"; @@ -84,6 +91,7 @@ in notifydaemon polkit-agent xdpg-workaround + idle-cmd ]; # Source a file (multi-file configs) diff --git a/system/common/wm.nix b/system/common/wm.nix index 30b6f20..ebcf555 100644 --- a/system/common/wm.nix +++ b/system/common/wm.nix @@ -14,6 +14,7 @@ in programs = { nm-applet.enable = mkDefault config.networking.networkmanager.enable; }; + security.pam.services.swaylock = {}; }; options = { nixfiles.common.wm.enable = mkEnableOption "common window manager configuration";