Repository navigation
refactor: fold duplicated rules onto one definition each - #33
Merged
Merged
Conversation
Geometry: isVisible and visibleCentre shared 26 byte-identical lines of grid decomposition, now coverGrid, and WarpPlan's visiblePart was a second copy of FocusRing's largest-overlap-screen search. Window identity: the CFEqual-then-frame-then-title rule that tells Electron's windows apart was written inline in focusMatches and liveFocusIndex as well as in Target ==. Both now go through sameWindow and windowTarget, so the rule has one definition. Modifiers: the four-modifier table was hand-written three times, in Agent, MenuBar and Hotkey. One extension carries the AppKit and Carbon translations instead. Shortcuts: Shortcut moves to file scope so Config.load reads the eight hotkey settings through the same defaultsKey and keyPath table that changeModifiers already writes through. Efficiency: the global mouse monitor was installed for the life of the process and handed every mouse event on the system, doing nothing whenever the loop was already at full poll; it is now installed only while idling, which also drops it while Heed is off. badgeCentres ran the grid sweep for every ring window and then kept nine. holdingApplies queried LaunchServices before asking the free question first. Also: WindowCandidate.canActivate was only ever true, --probe was missing the click-grace guard currentCondition has, and five doc comments were left mid-sentence or duplicated by 762c6e8.
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.
A cleanup pass over master: reuse, simplification, efficiency and altitude. No behaviour change is
intended anywhere, and the 265 unit tests, the release build and
make check-packageall pass.The recurring finding was one rule written out several times.
Geometry.
isVisibleandvisibleCentreshared 26 byte-identical lines of grid decomposition,which is the hardest geometry in the repo kept in two copies in the module that exists so it is
written once. That block is now
coverGrid; the two sweeps that follow it genuinely differ and stayapart.
WarpPlan.visiblePartwas a second copy ofFocusRing's largest-overlap-screen search andnow calls it.
Window identity. The CFEqual-then-frame-then-title rule that tells Electron's windows apart
lived inline in
focusMatchesand inliveFocusIndexas well as inTarget ==, and the copies hadalready drifted. Both now go through
sameWindow/windowTarget, soTarget ==is the onlydefinition. The CFEqual short-circuit stays in front of the two Accessibility reads.
Modifiers and shortcuts. The four-modifier table was hand-written three times, in
Agent,MenuBarandHotkey; one extension now carries the AppKit and Carbon translations.Shortcutmoves to file scope so
Config.loadreads the eight hotkey settings through the samedefaultsKey/keyPathtablechangeModifiersalready writes through, instead of restating the keystrings.
Efficiency. The global mouse monitor was installed for the life of the process and handed every
mouse event on the system, and its whole body was a bool test that is false precisely while the
mouse is moving. It is now installed only while the loop is idling, which also drops it while Heed
is switched off.
badgeCentresran the grid sweep for every ring window and then kept nine, whichis the latency before the badges appear.
holdingAppliesasked LaunchServices before asking thefree question.
Leftovers.
WindowCandidate.canActivatewas only evertrue(eligibility is decided ineligibleAppbefore the candidate is built), so the field and its unreachable reject arm are gone.--probewas missing the click-grace guardcurrentConditionhas, so it reported nothingsuppressing during a click grace window. Five doc comments were left mid-sentence or duplicated by
762c6e8, including the one recording why Outlook's reminder cannot be classified structurally.
Deliberately not done, all worth their own change: replacing
verifyFocus's spin-wait with thedidActivateApplicationnotification it already observes (it would delete theverifyTimeoutMssetting), skipping the pre-apply confirmation hit test at
dwellMs = 0, moving the entry-motionrule into
DwellMachineso it can be tested, samplingfrontmostApplicationonce per tick, andunifying the guard chain that
currentConditionand--probeboth spell out.Codex reviewed the diff for accidental behaviour changes and found one: memoising the Raycast
application scan let the Focus Window action run against a stale inventory if Heed were uninstalled
while the list was open. The memo is gone; the shared
findHeedlookup it was bundled with stays.