Repository navigation
Conversation
At desktop idle the shell was spawning 8 processes per second because panels/power/Status.qml ran a 1-second omarchy-battery-status timer (which also forked awk) across four live instances (bar, lock screen, control center, and power panel). RotationLock.qml likewise ran four separate 2-second polling timers and four startup busctl probes, while arch-ipad-auto-brightness rewrote its status JSON every second even when turned off and omarchy-powerd woke every second in both its main loop and playback_worker while lit. - Compute omarchy-battery-status size and rate in pure bash without awk (guarding optional sysfs reads, octal leading zeros, and integer width). - Share one UPower-signal-driven BatteryStatus singleton (30 s fallback, coalesced concurrent refreshes, on-demand refresh when Control Center or Power panel opens). - Share one RotationLockState singleton watching the config directory (and its parent for directory replacement) with one busctl probe and a shared setLocked() helper used by both Control Center and Display settings. - Give arch-ipad-auto-brightness a daemon-owned Unix wake socket (never touched by --probe/--dry-run), interrupt both enabled and disabled waits on CLI toggles, stop and reset sensor state while off, cache status only after atomic replace succeeds, report live brightness in cmd_status, update IioSource.interval on SIGHUP, and close PTY fds on Popen failure. - Watch omarchy-powerd inhibitor child exit via pidfd_open so the main loop can sleep until its 5 s key scan while honoring retry deadlines, and block playback_worker on the dark event while lit. Assisted-by: LLM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Tracing an idle J207 (iPad Pro 10.5-inch) session with
ftrace(sched_process_exec) showed 8 process forks per second (24 execs / 3 s) and 326arch_timerIRQs/s at complete desktop idle:panels/power/Status.qmlran a 1-secondomarchy-battery-status --shelltimer (which also forkedawk) across four live instances simultaneously (barStatusCluster, lock screenStatusCluster,ControlCenter, andpanels/power/Panel).plugins/status/RotationLock.qmlran four separate 2-second polling timers and four startupbusctlprobes.arch-ipad-auto-brightnesswoke every second and atomically rewrote its status JSON even when disabled.omarchy-powerdwoke every second in both its main loop (timeout()) andplayback_worker()(dark.wait(1)) while lit.Changes
desktop/shell/bin/omarchy-battery-status: computesize(Wh) andrate(W) in pure bash 64-bit integer arithmetic with zeroawkforks (guarding octal leading zeros, empty optional sysfs files underset -e, and digit-length overflow).qs.Commons.BatteryStatus(Commons/BatteryStatus.qml+ thinpanels/power/Status.qml): share one UPower-signal-driven reader (onBatteryChanged,displayDevicepercentage/state/present signals) with a 30 s fallback timer, coalesced concurrent refreshes (refreshPending), and on-demand refresh when Control Center or the Power panel opens.qs.Commons.RotationLockState(Commons/RotationLockState.qml+ thinplugins/status/RotationLock.qml): share onebusctlprobe and directory-watchedFileView(watching both~/.config/omarchyand its parent so directory replacement re-arms the watch) with no polling timer, plus a sharedtoggle()helper used by bothControlCenterandDisplayPage.desktop/configuration/auto-brightness: give the live daemon sole ownership ofstatus.jsonand a private Unix datagram wake socket (0o600, never touched by--probe/--dry-run, per-instance staging + inode-checked cleanup), interrupt both enabled and disabled waits on CLI toggles, stop and reset sensor state when off, cache status only after atomic replace succeeds, report live brightness incmd_status, updateIioSource.intervalonSIGHUP, and close PTY fds onPopenfailure.system/overlay/usr/libexec/omarchy-powerd: watch the inhibitor child viaos.pidfd_open()(1 s fallback if unavailable) so steadyONsleeps until its 5 s key scan while honoring retry deadlines and never spinning while waiting onlogind, and blockplayback_worker()ondark.wait()while lit.tests/test_idle_wakeups.py: unit tests covering pure-bashomarchy-battery-statuswithPATH="", singleton proxies,auto-brightnesswake socket /--probesafety / handoff cleanup, andomarchy-powerdidle timeouts.Live verification (J207 / iPad Pro 10.5-inch)
ftrace(sched_process_exec): 40 execs / 5 s → 0 background execs / 5 sarch_timerIRQs/s: 326/s → 80/s (4× reduction); CPU172 MHzresidency: 96% (4800 / 5000 ms)omarchy-powerdvoluntary context switches across all threads over 4 s lit idle: 1 (withpidfdattached)omarchy-auto-brightness:--probeleaves livestatus.jsonintact;on/offtoggles wake via Unix socket in <0.3 s;status.jsonuntouched while off.