summaryrefslogtreecommitdiff
path: root/modules/desktops/sway/idle.nix
blob: b3e3e06e0a6805af2e5c624f355d7a4d1e5c5bad (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
{config, ...}: {
  home-manager.users.${config.user} = {
    services.swayidle = {
      enable = config.desktops.sway;
      systemdTarget = "sway-session.target";

      timeouts = [
        {
          timeout = 300;
          command = "${config.default.lockScreen}";
        }
        {
          timeout = 300;
          command = "swaymsg \"output * power off\"";
          resumeCommand = "swaymsg \"output * power on\"";
        }
      ];

      events = [
        {
          event = "before-sleep";
          command = "${config.default.lockScreen}";
        }
      ];
    };
  };
}