blob: beff205c8f4c13ec2412384ab8f547abcfbf9838 (
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
 | import QtQml
import Quickshell
import Quickshell.Wayland
import qs.Services
import Custom as Custom
Scope {
  IdleMonitor {
    id: idleMonitor30
    timeout: 30
    onIsIdleChanged: Custom.Systemd.setIdleHint(idleMonitor30.isIdle)
  }
  IdleMonitor {
    id: idleMonitor540
    timeout: 540
    onIsIdleChanged: {
      if (idleMonitor540.isIdle)
	NiriService.sendCommand({ "Action": { "PowerOffMonitors": {} } }, _ => {});
    }
  }
  Connections {
    target: Custom.Systemd
    function onSleep(before: bool) {
      if (!before)
	NiriService.sendCommand({ "Action": { "PowerOnMonitors": {} } }, _ => {});
    }
  }
}
 |