From f619c397f228d4d9a2310f593188817107701243 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 19 Jul 2026 22:28:33 -0700 Subject: [PATCH] Make status indicators event-driven instead of polling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The indicators widget broadcast a refresh every 2s, fanning out to four status subprocesses (nightlight, idle, reminder, screen-recording), and NightLight/StayAwake each ran an additional 5s poll. On an idle desktop this was the dominant source of process churn (~33 of ~53 forks/sec in a VM). The state-changing commands already push `omarchy.indicators refresh` over IPC, so the polling was redundant. Drop the 2s broadcast and the two 5s timers; indicators now refresh at startup and on the IPC push. Also fix three callers that pushed to the wrong target `Indicators` instead of `omarchy.indicators` (screen recording, notification silencing, and the omarchy-shell help example) — those pushes silently failed and only appeared to work because the poll masked them. Idle fork rate drops ~53/s to ~20/s. Co-Authored-By: Claude Fable 5 --- bin/omarchy-capture-screenrecording | 2 +- bin/omarchy-shell | 2 +- bin/omarchy-toggle-notification-silencing | 2 +- shell/plugins/bar/indicators/NightLight.qml | 7 ------- shell/plugins/bar/indicators/StayAwake.qml | 7 ------- shell/plugins/bar/widgets/Indicators.qml | 8 +------- 6 files changed, 4 insertions(+), 24 deletions(-) diff --git a/bin/omarchy-capture-screenrecording b/bin/omarchy-capture-screenrecording index 26fc9e3a..49ffa04e 100755 --- a/bin/omarchy-capture-screenrecording +++ b/bin/omarchy-capture-screenrecording @@ -222,7 +222,7 @@ stop_screenrecording() { } toggle_screenrecording_indicator() { - omarchy-shell -q Indicators refresh + omarchy-shell -q omarchy.indicators refresh } screenrecording_active() { diff --git a/bin/omarchy-shell b/bin/omarchy-shell index 8b6c9011..3cc7eaaa 100755 --- a/bin/omarchy-shell +++ b/bin/omarchy-shell @@ -29,7 +29,7 @@ Options: Examples: omarchy-shell shell ping - omarchy-shell -q Indicators refresh + omarchy-shell -q omarchy.indicators refresh omarchy-shell shell listPlugins omarchy-shell shell toggle omarchy.menu '{"menu":"root"}' USAGE diff --git a/bin/omarchy-toggle-notification-silencing b/bin/omarchy-toggle-notification-silencing index ee336e3d..c293fc5e 100755 --- a/bin/omarchy-toggle-notification-silencing +++ b/bin/omarchy-toggle-notification-silencing @@ -3,4 +3,4 @@ # omarchy:summary=Toggle notification do-not-disturb mode state=$(omarchy-shell notifications toggleDnd 2>/dev/null || echo "") -omarchy-shell -q Indicators refresh +omarchy-shell -q omarchy.indicators refresh diff --git a/shell/plugins/bar/indicators/NightLight.qml b/shell/plugins/bar/indicators/NightLight.qml index 9fadf12d..8388a71a 100644 --- a/shell/plugins/bar/indicators/NightLight.qml +++ b/shell/plugins/bar/indicators/NightLight.qml @@ -54,12 +54,5 @@ BarIndicator { onTriggered: root.refresh() } - Timer { - interval: 5000 - running: true - repeat: true - onTriggered: root.refresh() - } - onPressed: function() { root.toggle() } } diff --git a/shell/plugins/bar/indicators/StayAwake.qml b/shell/plugins/bar/indicators/StayAwake.qml index c6ecb37f..7a2eb9e3 100644 --- a/shell/plugins/bar/indicators/StayAwake.qml +++ b/shell/plugins/bar/indicators/StayAwake.qml @@ -48,12 +48,5 @@ BarIndicator { onTriggered: root.refresh() } - Timer { - interval: 5000 - running: true - repeat: true - onTriggered: root.refresh() - } - onPressed: function() { root.toggle() } } diff --git a/shell/plugins/bar/widgets/Indicators.qml b/shell/plugins/bar/widgets/Indicators.qml index 0785fd6d..bf6e42c2 100644 --- a/shell/plugins/bar/widgets/Indicators.qml +++ b/shell/plugins/bar/widgets/Indicators.qml @@ -174,13 +174,7 @@ BarWidget { } } - Timer { - interval: 2000 - running: true - repeat: true - triggeredOnStart: true - onTriggered: root.refreshRequested() - } + Component.onCompleted: root.refreshRequested() Row { id: horizontalIndicators