summaryrefslogtreecommitdiff
path: root/hm/env/swayidle.nix
blob: 1d703cc2d67f8443673b3d13a316158e21460977 (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
{ 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;
      systemdTarget = "graphical-session.target";
      events = {
       before-sleep = "${pkgs.swaylock-effects}/bin/swaylock -f";
       lock = "${pkgs.swaylock-effects}/bin/swaylock -f";
      };
      timeouts = [
        { timeout = 300; command = "${pkgs.swaylock-effects}/bin/swaylock -f"; }
        {
          timeout = 600;
          command = "${pkgs.niri-unstable}/bin/niri msg action power-off-monitors";
          resumeCommand = "${pkgs.niri-unstable}/bin/niri msg action power-on-monitors";
        }
      ];
    };
  };
}