36 lines
1.1 KiB
Nix
36 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
let
|
|
swaylock-package = config.nathan.config.desktop.swaylock.package;
|
|
swaylock-command = config.nathan.config.desktop.swaylock.command;
|
|
targets = config.nathan.config.desktop.targets;
|
|
in lib.mkMerge [
|
|
(lib.mkIf config.nathan.programs.hyprland.enable {
|
|
wayland.windowManager.hyprland.extraConfig = ''
|
|
bind = SUPER, Z, exec, ${swaylock-package}/bin/swaylock ${swaylock-command}
|
|
'';
|
|
})
|
|
({
|
|
home.packages = with pkgs; [ swaylock-package swayidle ];
|
|
|
|
services.swayidle = {
|
|
enable = true;
|
|
timeouts = [
|
|
# Lock the screen after 5 minutes of inactivity
|
|
{
|
|
timeout = 300;
|
|
command = "${swaylock-package}/bin/swaylock ${
|
|
builtins.replaceStrings [ "%" ] [ "%%" ] swaylock-command
|
|
}";
|
|
}
|
|
# Turn off the displays after 10 minutes of inactivity
|
|
{
|
|
timeout = 600;
|
|
command = "hyprctl dispatch dpms off";
|
|
resumeCommand = "hyprctl dispatch dpms on";
|
|
}
|
|
];
|
|
};
|
|
systemd.user.services.swayidle = { Install = { WantedBy = targets; }; };
|
|
})
|
|
]
|