Let the tray icon say whether traffic is being carried - #73
Merged
Conversation
Asked for in #63: knowing whether the connection is up meant opening the window, when the icon is already on screen and could simply say so. The menu and the tooltip have carried the status all along, but both need a click or a hover. A colour needs neither, which is the whole point of having an icon. Green connected, amber connecting or stopping, red failed, grey disconnected. The first attempt left the connected icon untinted, on the reasoning that the ordinary state should look like the application rather than a status light. Looking at the four together showed that was wrong: this logo is dark and nearly monochrome, so connected and disconnected came out black and grey — the weakest distinction in the set, and the one the feature exists to make. On a dark taskbar the untinted one all but disappears. The variants are derived from the embedded logo at runtime rather than shipped as four more files. That source is a 1024px PNG costing 1.6 MB in the binary; four would be six, to say one of four things. Each derived icon is about 7 KB. It also leaves the icon with one source of truth, so redrawing the logo cannot leave three stale copies behind. Tinting goes through luminance rather than multiplying the original channels, which would leave the dark parts almost black and let only the light parts take the colour — a smudge rather than a state. Scaling is a box filter, because dropping fifteen pixels in sixteen off thin strokes is how an icon ends up looking drawn with a broken pen. If the logo cannot be decoded, every state gets the icon that shipped and the tray looks exactly as it did before. An icon that does not change colour is a small loss; no icon at all is an app that cannot be reached once its window is closed.
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.
Closes #63.
Knowing whether the connection was up meant opening the window. The menu and tooltip have carried the status all along, but both need a click or a hover — a colour needs neither, which is the whole point of having an icon.
The first attempt was wrong, and looking at it showed why
The connected icon was originally left untinted, reasoning that the ordinary state should look like the application rather than a status light.
Rendering the four and putting them side by side settled it: this logo is dark and nearly monochrome, so connected and disconnected came out black and grey — the weakest distinction in the set, and precisely the one the feature exists to make. On a dark taskbar the untinted version all but disappears.
Green is what every other client on the platform uses for this, and it survives being sixteen pixels wide.
Derived, not shipped
The variants are built from the embedded logo at runtime rather than added as four more files. That source is a 1024px PNG already costing 1.6 MB in the binary; four would be six, to say one of four things. Each derived icon is about 7 KB — smaller than the 123 KB
.icothat ships today, and there is a test asserting it stays that way.It also leaves the icon with one source of truth, so redrawing the logo cannot leave three stale copies behind.
Two details that matter for how it looks
No new dependency —
image/pngand about twenty lines of averaging.Failure behaviour
If the logo cannot be decoded — which would mean the embedded asset is broken and the build is wrong — every state gets the icon that ships today and the tray looks exactly as it does now. An icon that does not change colour is a small loss; no icon at all is an app that cannot be reached once its window is closed.
Testing
Four tests, including one that asserts no two states produce the same image — which is the failure the first attempt would have shipped. Also covers the ICO container on Windows (Vista-style, PNG inside), unknown statuses still yielding an icon, and the size claim above.
Builds and vets clean for darwin and linux as well as Windows.
🤖 Generated with Claude Code