summaryrefslogtreecommitdiff
path: root/modules/home-manager/swayidle.nix
blob: 19cd171bbd24f840f8cee8111b2565bed1e29e4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ pkgs, ... }: {
  services.swayidle = {
    enable = true;
    systemdTarget = "hyprland-session.target";
    timeouts = 
      let
        dpmsCommand = "${pkgs.hyprland}/bin/hyprctl dispatch dpms";
        brightnessCommand = "${pkgs.brightnessctl}/bin/brightnessctl -s %% brightnessctl s";
      in 
      [
        { #timeout 180
          timeout = 3;
          command = "${brightnessCommand} 15%";
          resumeCommand = "brightnessctl -r";
        }
        {
          #timeout 300
          timeout = 5;
          command = "${dpmsCommand} off && swaylock";
          resumeCommand = "${dpmsCommand} on";
        }
        { #timeout 420
          timeout = 7;
          command = "${brightnessCommand} 0%";
          resumeCommand = "brightnessctl -r";
        }
      ];
    # events.before-sleep.event = "swaylock";
  };
}