Repository navigation
Cosmetic: Fix the checked-out branch badge being dim and never updating - #697
Merged
Merged
Conversation
This was referenced Sep 20, 2026
goneng
marked this pull request as ready for review
September 20, 2026 21:56
goneng
force-pushed
the
refresh-the-checked-out-badge
branch
from
September 21, 2026 05:25
8d3c004 to
4d0e819
Compare
Refresh the sidebar's checked-out badge whenever its window becomes or stops being the main window, so it shows the state the window is in rather than the one it happened to be in when the row was built. - Observe the window's main-state notifications from the cell and re-derive the badge on each change. - Re-derive it on entering a window too, which is what the first sidebar reload misses: that reload runs from awakeFromNib, before the window is main. - Cover the wiring rather than the colour, a test process having no way to make a window genuinely main.
goneng
force-pushed
the
refresh-the-checked-out-badge
branch
2 times, most recently
from
September 21, 2026 07:05
975f77d to
a9ef30c
Compare
goneng
marked this pull request as draft
September 21, 2026 07:08
goneng
force-pushed
the
refresh-the-checked-out-badge
branch
from
September 21, 2026 07:12
a9ef30c to
d6b5770
Compare
The badge has a colour for each state it can be in, but none of them read as different: the checkmark stayed dim on the row just selected, and the inactive colour matched the active one in brightness, so losing focus changed only the hue. - Decide the checkmark colour from the window being main, the way the capsule around it already does. - Drop the key-window branch this replaces: a row is only emphasized while its window is key, so the dimmed result was the only one the selected row could reach. - Darken the inactive colour, a 22% drop in relative luminance, so an inactive badge reads as dim rather than merely as less blue. - Knock the checkmark out of the capsule while the window is inactive, leaving it hollow. Painting it the sidebar's own colour would match only on an unselected row, and read as a pale checkmark on a selected one.
goneng
force-pushed
the
refresh-the-checked-out-badge
branch
from
September 21, 2026 07:22
d6b5770 to
c883fcf
Compare
goneng
marked this pull request as ready for review
September 21, 2026 07:23
Contributor
hannesa2
approved these changes
Sep 21, 2026
hannesa2
left a comment
Contributor
There was a problem hiding this comment.
Nice, it comes even with a test
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.

Make the sidebar's checked-out badge show the state the window is actually
in, rather than the one it happened to be in when the row was built, and
give its two states a look that tells them apart.
How We Got Here
Found while chasing why the UI screenshot comparison reports differences
on pull requests that change nothing visible (#693). Two back-to-back
runs of the screenshot tests, same commit and same repository state,
produced a badge that was grey in one and blue in the other.
window. Nothing in the app observed window state at all, and the badge
is a bitmap baked at the moment the row is configured. The first
sidebar reload runs from
awakeFromNib, before the window is main, sothe badge baked grey and stayed grey until some unrelated reload
happened to rebuild it. Which side of the shutter that landed on is
the difference above.
an active window. A row is only emphasized while its window is key, so
the key-window branch this replaces could never be taken by the
selected row and the checkmark was always dimmed.
The two belong together: after the second change
isMainWindowis theonly window signal the control reads, so the observers added by the
first cover all of it.
Beyond the screenshots, this is visible in ordinary use: the badge does
not dim when GitX goes to the background, nor light up when it comes
back, for any row that is not the selected one.
Making The Inactive State Actually Look Inactive
Fixing the refresh exposed a second problem: the badge now updated on
losing focus, but barely changed when it did. The active and inactive
capsule colors turned out to have the same brightness, 0.3972 against
0.3987 in relative luminance, so going inactive changed only the hue.
inactive badge reads as dim rather than merely as less blue.
leaving it hollow so the row behind shows through it. Painting the
checkmark the sidebar's own color was the obvious alternative and is
wrong: the sidebar is 246 and a selected row is 220, so a fixed color
matches on an unselected row and reads as a pale checkmark on a
selected one.
The two are linked. The hole is only visible while the capsule differs
from what shows through it, which puts a floor under how light the
capsule can go. Matching the capsule to the selection color, which would
be the natural next step, makes the badge vanish outright on a selected
row: same color, and a checkmark that is a hole rather than a shape.
Expected Behavior (and Look)
The checked-out row's capsule turns white -
the checkmark inside should be blue, not grey.
Badge returns to blue capsule with white checkmark.
The badge should dim and re-light. (Master does neither.)
The capsule goes to a darker grey and the checkmark becomes a hole.
switch apps again (the case AppKit never rescued, where Master is
most obviously stuck).
The images in 3 and 4 were taken before the hollow checkmark and the
softer capsule, so they show the right states in the older colors.
Test plan
applied. In each case only the case under test failed without it,
while the controls passed in both runs.
make unit-testpasses: 158 tests, no failures.process having no way to make a window genuinely main; the refresh
tests assert the badge is rebuilt rather than what color it becomes,
for the same reason.
fixed colors: one test computes relative luminance and requires the
inactive capsule to be at least 20% darker, another renders both
badges and requires the inactive one to carry more transparent pixels.