summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/NiriIdle.qml
blob: faa77c3fc7d06beb34d662f1272848f5de6fcae4 (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" });
    }
  }
}