Files
omarchycn/shell/plugins/bar/indicators/StayAwake.qml
T
David Heinemeier HanssonandClaude Fable 5 bee9ab476c Bind the Stay Awake indicator to the idle service
The indicator polled omarchy-toggle-idle over a Process and re-ran it on
a timer to toggle, while the CLI called back into the shell over IPC to
apply and refresh the state it had just changed. Now the indicator binds
straight to the idle service's stayAwake property and flips it in
process. The CLI only touches the state file, which the service already
watches, so toggling from keybindings and scripts still reaches the
shell without any reentrant IPC.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 15:25:49 -07:00

21 lines
473 B
QML

import QtQuick
import qs.Ui
BarIndicator {
id: root
readonly property var idleService: bar?.shell?.firstPartyServiceFor("omarchy.idle")
active: idleService ? idleService.stayAwake : false
activeText: "󰅶"
inactiveText: "󰅶"
activeTooltipText: "Allow Idle Lock & Screensaver"
inactiveTooltipText: "Stay Awake"
function toggle() {
if (root.idleService) root.idleService.setIdleEnabled(root.active)
}
onPressed: function() { root.toggle() }
}