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>
This commit is contained in:
co-authored by
Claude Fable 5
parent
51d6d3c291
commit
bee9ab476c
@@ -24,10 +24,21 @@ ShellRoot {
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: idleService
|
||||
property bool stayAwake: false
|
||||
readonly property bool idleEnabled: !stayAwake
|
||||
function setIdleEnabled(value) {
|
||||
stayAwake = !value
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: mockShell
|
||||
function firstPartyServiceFor(id) {
|
||||
return id === "omarchy.notifications" ? notificationService : null
|
||||
if (id === "omarchy.notifications") return notificationService
|
||||
if (id === "omarchy.idle") return idleService
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +162,7 @@ ShellRoot {
|
||||
stayAwake.moduleName = "StayAwake"
|
||||
root.injectBar(stayAwake)
|
||||
stayAwake.triggerPress(Qt.LeftButton)
|
||||
root.assertTrue(root.commandCount("omarchy-toggle-idle") === 1, "Stay Awake left click runs idle toggle command")
|
||||
root.assertTrue(idleService.stayAwake === true, "Stay Awake left click toggles the idle service")
|
||||
}
|
||||
|
||||
root.writeResult()
|
||||
|
||||
Reference in New Issue
Block a user