Show the running device count in the menu bar - #2
Open
arthurrmp wants to merge 1 commit into
Open
Conversation
The status item now carries a count of everything currently booted across both platforms, so the number of running devices is readable without opening the panel. Keeping that count accurate while the panel is closed could have meant a background timer, but both toolchains already record run state on disk: CoreSimulator rewrites Devices/<UDID>/device.plist on every transition, and the emulator creates <name>.avd/hardware-qemu.ini.lock at launch and removes it on exit. DeviceDirectoryWatcher watches those directories with vnode dispatch sources, so nothing runs until a device actually changes. The plist is replaced atomically, so the enclosing directory is watched rather than the file, whose inode does not survive the write. The panel's own five second refresh loop is removed as well; it is now a single refresh on open, since state arrives by event. One bounded exception: an emulator writes its lock at launch but only reports `device` to adb once the guest finishes booting, and that transition touches no watched directory, so a refresh that still sees a booting device schedules one more two seconds later until nothing is booting. The count is drawn into an NSImage rather than rendered as a SwiftUI Label, which was re-rendering its text on a recurring tick and cost about 720 idle wakeups an hour for a number that changes a handful of times a day. Measured over fifteen minute idle windows: a fifteen second poll costs ~33 CPU-seconds an hour with 480 process spawns; this costs ~3, with zero spawns, zero watcher events and zero idle wakeups. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
arthurrmp
force-pushed
the
feat/menubar-device-count
branch
from
August 31, 2026 04:49
62d71b8 to
4e3056f
Compare
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.
Thanks for the app, it's genuinely useful.
This adds a count next to the menu bar icon so you can see how many devices are booted without opening the panel. I wanted it for myself, so opening it to see if it fits your project. Happy to gate it behind a setting if needed.
Tests pass, 74/74.