Repository navigation
Automation: Karabiner import · perf: resource audit fixes (ported from the Codex session) - #95
Merged
Merged
Conversation
Import Settings now takes Hammerspoon Lua, Karabiner JSON, or a JavaScript extension. Karabiner's basic key-to-key mappings (with mandatory/optional modifiers, up to 128) become native remaps applied on the event tap, so no JavaScript runs per key event; unsupported Karabiner features (conditions, macros, hyper) are reported before importing. Display queries are batched and held keys survive the watchdog's checks. The dock's ⌃⌥ profile keys are still claimed through InAppHotkeys before Automation registers. Written in a parallel Codex session on the main checkout and ported onto main after R15 (#94) merged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
From a resource audit of the app (143 source files, 30 bundled widgets): - Script and exec runtimes: pipe readers share one deadline; stdout lines are bounded (newline-terminated ones too), stderr at 64 KiB, the stdout event queue at 128, timers at 128 per widget. - Native refresh generations reject results that came back after a reload, remove, or disable, keeping refresh ownership straight. - Caches drop removed entries, late loads cannot re-cache them, and commit only after a successful disk write; failed chart saves stay retryable. Memory/disk sampling is coalesced on a sleep-aware monotonic clock (MetricSampleCache). - Menu bar entries rebuild only on changes they show; unused maintenance timers stop. Thumbnails and remote images retry and cache more carefully; directory watchers clean up. - Dock: icons and names cached per path for a minute, at most 256 (DockFilePresentationCache), replacing the unbounded cache. Written in a parallel Codex session on the main checkout and ported onto main after R15 (#94) merged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Swift 6.4 warns that the outer closure captured runtime strongly while the inner one asked for weak; both are weak now. No compiler warnings. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Both failed now and then (CI, and 2 in 5 runs locally): the service calls back as soon as it cancels, but the URL protocol hears of the cancel on its own thread a moment later, so stoppedRequests was still 0 when checked. They now wait for it. The stalled-download test also held the healthy image to a 0.15 s deadline, which a loaded runner missed; 1 s still shows the stall being cut off. 0 failures in 15 runs of the suite and 3 runs of everything. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ts, refresh churn, sampling, exec timeout From a review of #95: - Key remaps from arrows, Home/End, Page Up/Down, Forward Delete and F keys never fired: macOS sets fn on those events, so control+left_arrow arrived as control|fn. fn is left out of matching there, and requiring fn on such a key is refused (it cannot be told apart). - Karabiner import accepts what current Karabiner writes on its own (keyboard_type_v2, the device-open delay, basic.* timeouts, device entries, machine_specific, rule 'enabled'; disabled rules stay off; media-only fn_function_keys are left to macOS and said so). Remaps, ignored keyboards and F keys sent as other keys are still refused. - Only real chains are refused: an output some rule takes with no modifier, or a rule mapping a key to itself. - Script stdout waiting for the host is bounded by size (8 MB), not by count: 200 log lines in one write no longer kill a healthy script. Complete lines ahead of an oversized one are still delivered. - A widget reload outdates in-flight refreshes only for widgets whose manifest or folder changed; every reload used to discard each running result and run its command again. - Disk/memory samples lock per key, so a hung volume no longer stalls every other widget's samples. - An exec that exits just inside its timeout is not reported as timed out while its output is still being read. - Karabiner and key-remap messages are localized (ko). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Work done in a parallel Codex session on the main checkout while R15 was in progress, ported onto
mainafter #94 merged.What
0ca81b8): Import Settings takes Hammerspoon Lua, Karabiner-Elements JSON, or JavaScript. Karabiner's key-to-key mappings become native remaps on the event tap (no JavaScript per key event); unsupported Karabiner features are reported before importing. Display/AX queries batched; held keys survive watchdog checks.a9d3c14): bounded script/exec runtimes (shared pipe deadline, stdout/stderr/event-queue/timer limits), stale native refresh results rejected across reload/remove/disable, cache pruning and commit-after-write, coalesced memory/disk sampling (MetricSampleCache), fewer menu bar rebuilds, thumbnail/remote image retry and caching, directory watcher cleanup, and a bounded expiring Dock icon cache (DockFilePresentationCache, replacing the unbounded one from feat(dock): BarShelf Dock — widgets, launchers, profiles, Apple Dock layouts (R15) #94).83e0f1b: the last compiler warning (implicit strong capture in the builder sheet).How it was ported
git apply --3wayontomain: no conflicts. Dock files: the checkout held early versions of feat(dock): BarShelf Dock — widgets, launchers, profiles, Apple Dock layouts (R15) #94's own changes, somain's were kept except Codex's icon cache, adopted here. The twoInAppHotkeyslines inAutomationEnginefrom feat(dock): BarShelf Dock — widgets, launchers, profiles, Apple Dock layouts (R15) #94 are kept.main's, plus the 9 strings Codex added (with Korean)..context/resource-audit-*.json, ~2.5k lines each) are left out.Verified
swift build: no errors, no warnings; the first commit builds on its own.swift test: all green (Core 607, App 327, CLI), including Codex's new tests (Karabiner import, native refresh gate, exec pipe deadlines, metric sampling, registry network, storage lifecycle, thumbnails).scripts/sync-strings.sh --check: ok.🤖 Generated with Claude Code