feat(tray): add now playing section with playback controls#53
Merged
flexiondotorg merged 6 commits intomainfrom Mar 26, 2026
Merged
feat(tray): add now playing section with playback controls#53flexiondotorg merged 6 commits intomainfrom
flexiondotorg merged 6 commits intomainfrom
Conversation
Add tray tooltip functionality to display the currently playing track name and artist. Updates tooltip on track changes and resets when playback stops. - Add updateTrayTooltip function to format and display track metadata - Listen to nowPlayingItemDidChange events and update tooltip with track information - Listen to playbackStateDidChange events to clear tooltip when playback ends - Ignore null payloads in nowPlayingItemDidChange to prevent tooltip reset during track transitions - Include debug logging for tooltip updates Signed-off-by: Martin Wimpress <code@wimpress.io>
- Add Now Playing section at top of tray context menu with track name, artist, and album using Linux-specific glyphs - Implement playback controls (Previous/Play/Pause/Next) with state-aware icons and Linux glyph symbols - Add Volume submenu with radio items (Mute/25%/50%/75%/100%) showing current volume level as percentage - Implement metadata truncation: split on first `(` or `[`, hard-truncate at 32 chars with ellipsis - Rebuild menu on track change, playback state change, and volume change - Clear Now Playing section after 30 seconds of pause to mirror Discord integration behaviour - Add i18n support with 20 new tray.json records across 32 languages Signed-off-by: Martin Wimpress <code@wimpress.io>
- Add test suite for metadata truncation logic - Verify splitting on `(` and `[` characters - Confirm 32-character hard truncation with ellipsis - Ensure edge cases are handled (empty strings, already short values) Signed-off-by: Martin Wimpress <code@wimpress.io>
- Replace & with fullwidth ampersand (U+FF06) in track/artist/album names to prevent Pango markup entity parsing on Linux - Add sanitiseLinuxLabel helper and apply on Linux for menu labels only - Retain Pango escaping for tooltip text which is handled separately - Add test coverage for sanitiseLinuxLabel with 4 test cases Signed-off-by: Martin Wimpress <code@wimpress.io>
- Document Now Playing section with metadata items and glyphs - Document playback controls (Previous/Play/Pause/Next) - Document Volume submenu with preset levels - Document metadata truncation at 32 characters - Document menu rebuild triggers and pause timeout behavior - Document Tray subsection with Linux glyph conventions Signed-off-by: Martin Wimpress <code@wimpress.io>
Contributor
There was a problem hiding this comment.
4 issues found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="AGENTS.md">
<violation number="1" location="AGENTS.md:208">
P3: The documented total translation record count is incorrect (29 vs actual 30), which makes the i18n reference inconsistent.</violation>
</file>
<file name="docs/SPECIFICATION.md">
<violation number="1" location="docs/SPECIFICATION.md:748">
P3: The Tray glyph convention says no `U+1F000+` codepoints are used, but this same section includes `🞂` and `🕪` (`U+1F782`/`U+1F56A`). Update the sentence so the spec matches the documented labels.</violation>
</file>
<file name="src/tray.ts">
<violation number="1" location="src/tray.ts:53">
P3: truncateMenuLabel can exceed the maxLength because it appends the ellipsis after taking maxLength characters. Trim to maxLength - 1 before adding the ellipsis so the final label stays within the limit.</violation>
</file>
<file name="src/main.ts">
<violation number="1" location="src/main.ts:404">
P2: The async artwork download can race across track changes and apply stale Now Playing data to the tray. Guard against outdated async completions before updating state.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- Add staleness guard to artwork download handler to prevent overwriting current track state with stale async results on rapid track changes - Correct translation record count from 29 to 30 in AGENTS.md - Clarify tray glyph convention in SPECIFICATION.md: seven glyphs use Unicode blocks in U+1F000+ range, not all below as previously stated Signed-off-by: Martin Wimpress <code@wimpress.io>
Contributor
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/main.ts">
<violation number="1" location="src/main.ts:407">
P2: Avoid reference-identity checks for stale artwork guards; compare a deterministic track key instead so equivalent payload objects don't incorrectly cancel artwork updates.
(Based on your team's feedback about avoiding reference-identity guards in artwork update paths.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
Summary
Adds a comprehensive Now Playing section to the tray context menu, displaying current playback information and providing intuitive controls. The feature mirrors Discord's pause timeout behaviour and includes a volume submenu with percentage display.
Changes
(or[)Testing
Related Issues
Implements tray Now Playing feature as specified in SPECIFICATION.md