summaryrefslogtreecommitdiff
path: root/hm/env/swayidle.nix
blob: 11e562c3abd1f9436749b059722dd64357e090e9 (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
31
32
33
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.hm.env.swayidle;
in
{
  options.hm.env.swayidle.enable = lib.mkEnableOption "enables swayidle";
  config = lib.mkIf cfg.enable {
    services.swayidle = {
      enable = true;
      systemdTargets = [ "graphical-session.target" ];
      events = {
        # before-sleep = "${pkgs.swaylock-effects}/bin/swaylock -f";
        lock = "${pkgs.swaylock-effects}/bin/swaylock -f";
      };
      timeouts = [
        {
          timeout = 600;
          command = "${pkgs.swaylock-effects}/bin/swaylock -f";
        }
        {
          timeout = 600;
          command = "niri msg action power-off-monitors";
          resumeCommand = "niri msg action power-on-monitors";
        }
      ];
    };
  };
}