Expose the battery percentage toggle through omarchy.power IPC

omarchy-shell omarchy.power togglePercentage now flips the same setting
the widget's right-click does. Follows the monitor/tailscale pattern:
manageIpc: false so the panel owns the target's single IpcHandler and
can extend it past the inherited lifecycle methods.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-08-01 15:36:34 -05:00
co-authored by Claude Fable 5
parent 7020a6ea57
commit 0af39c5260
2 changed files with 16 additions and 0 deletions
+14
View File
@@ -10,6 +10,9 @@ Panel {
id: root
moduleName: "omarchy.power"
ipcTarget: "omarchy.power"
// manageIpc: false so this panel can own the single IpcHandler the target
// permits — needed for the togglePercentage method below.
manageIpc: false
property var batteryInfo: ({})
property var systemInfo: ({})
property var profiles: []
@@ -171,6 +174,17 @@ Panel {
if (root.bar && root.bar.shell) root.bar.shell.updateEntryInline(root.moduleName, root.settings)
}
IpcHandler {
target: "omarchy.power"
function open() { root.open() }
function close() { root.close() }
function show() { root.open() }
function hide() { root.close() }
function toggle() { root.toggle() }
function togglePercentage() { root.togglePercentage() }
}
onOpenedChanged: {
if (opened) {
if (!batteryPresent) {