Skip to content

Let the tray icon say whether traffic is being carried - #73

Merged
DarkPoesidon merged 1 commit into
mainfrom
feat/tray-icon-shows-state
Aug 26, 2026
Merged

Let the tray icon say whether traffic is being carried#73
DarkPoesidon merged 1 commit into
mainfrom
feat/tray-icon-shows-state

Conversation

@DarkPoesidon

Copy link
Copy Markdown
Collaborator

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.

State Colour
Connected green
Connecting / stopping amber
Failed red
Disconnected grey

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 .ico that 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

  • Tinting goes through luminance, not by multiplying the original channels. Multiplying leaves the dark parts almost black and lets only the light parts take the colour, which reads as a smudge rather than a state.
  • Scaling is a box filter. Dropping fifteen pixels in sixteen off a logo with thin strokes is how an icon ends up looking drawn with a broken pen.

No new dependency — image/png and 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

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.
@DarkPoesidon
DarkPoesidon merged commit 75bf92f into main Aug 26, 2026
7 checks passed
@DarkPoesidon
DarkPoesidon deleted the feat/tray-icon-shows-state branch August 26, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Try Icon پیشنهاد تغییر رنگ

1 participant