Repository navigation
Show the headset's battery on the tray icon - #1
Merged
Merged
Conversation
The icon by the clock can now draw the battery instead of Neap's glyph: either a battery filled to the charge or the charge as a number, chosen on the Settings page. Either turns red at a low level the person sets (20% by default), and the battery shows a bolt while charging. With no reading, a settling one, or "Neap" chosen, the icon is Neap's glyph, so an empty bar or a stale number never stands in for "unknown". When to draw it, how full and whether it is low is decided in Core (TrayBattery) with tests; the desktop only renders it, at 32 px on even pixels so it stays sharp halved to 16, in the taskbar's shade.
The repository keeps its design choices in DECISIONS.md; this one sets out the styles considered, the default, and the user-set low level.
Two more choices for the icon by the clock: a headset with a battery in its bottom-right corner, and a headset with the charge as a number there. Both cut a gap around the corner so the two read apart, and turn red at the low level like the other styles. While the headset is known to be away (nothing plugged in, or a transmitter with the headset off or out of range) they draw a faint headset struck through; while Neap is still asking, or the settings are out of reach with sound still playing, the glyph stands in, as it does for the other styles. With five choices, the Settings card lists them as rows under its name rather than as segments.
The headset and number style says whose charge it is, the exact charge, and when the headset is disconnected, so it serves a new install best.
…ray icon Two fixed steps replace the low battery setting: orange says charge soon, red says charge now, with nothing to tune. On power the charge keeps the taskbar's shade. The Settings card is renamed "System tray icon", the name people know the area by, and its line says when the colours change, now that there is no setting that does.
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.
Requested by Stephen · project thread
What
The notification-area icon can show the headset's battery instead of Neap's glyph. Settings gets two cards, both hidden where the desktop shows no tray icons:
Battery is a monochrome battery in the taskbar's shade, filled to the charge. The fill turns red at the low level, and a bolt shows while charging. Percentage is the charge as a number, as large as fits, and turns red at the low level too. With no reading, a settling one, or Neap chosen, the icon goes back to Neap's glyph, so an empty bar or a stale number never stands in for "unknown". The tooltip still gives the charge in words.
How
Neap.Core/Connection/TrayBattery.csdecides whether to draw the battery, how full, and whether it is low, withTrayBatteryTests.Neap.Desktop/TrayBatteryPicture.csrenders it to a 32 px bitmap. Edges sit on even pixels so it stays sharp when halved to 16 px.MainWindow.Tray.csredraws the icon only when what it shows changes. The taskbar shade is read once at startup and again when Windows reports a colour change.tray_iconandtray_warn_atinapp-settings.json. Strings are inResources.resw, and there is a CHANGELOG line.Verified
dotnet build src/Neap.Desktop -c Release -f net10.0, 1253 Core tests passing, anddotnet format --verify-no-changesclean on the four projects.Generated by Claude Code