diff --git a/flake.nix b/flake.nix index d7244a7..41f0273 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ ./fonts.nix ./hardware-configuration.nix ./hyprland-system.nix + ./lock-suspend.nix ./networking.nix ./nix-settings.nix ./opengl.nix diff --git a/hyprland.nix b/hyprland.nix index f201076..5bab647 100644 --- a/hyprland.nix +++ b/hyprland.nix @@ -69,8 +69,9 @@ }; "$mod" = "SUPER"; - "$term" = "kitty"; - "$menu" = "wofi --show run"; + "$term" = "${pkgs.kitty}/bin/kitty"; + "$menu" = "${pkgs.wofi}/bin/wofi --show run"; + "$lock" = "${pkgs.hyprlock}/bin/hyprlock -n"; bind = [ "$mod SHIFT, RETURN, exec, $term" @@ -78,7 +79,7 @@ "$mod SHIFT, Q, exit" "$mod, P, exec, $menu" - "$mod, mouse:272, movewindow" + "$mod, L, exec, $lock" "$mod, H, movefocus, l" "$mod, J, movefocus, r" diff --git a/lock-suspend.nix b/lock-suspend.nix new file mode 100644 index 0000000..75796eb --- /dev/null +++ b/lock-suspend.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + services.logind = { + lidSwitch = "suspend"; # suspend on lid close + handleLidSwitch = "suspend"; # explicit + }; + + systemd.services.hyprlock-pre-suspend = { + description = "Lock screen before suspend"; + serviceConfig = { + Type = "oneshot"; + # Run as your user + ExecStart = "${pkgs.hyprlock}/bin/hyprlock -n"; + }; + install.wantedBy = [ "sleep.target" ]; + }; + +}