Skip to content

feat(status-area): honor SNI Status, attention icon, and live property changes#1427

Open
BrianHotopp wants to merge 4 commits into
pop-os:masterfrom
BrianHotopp:fix-sni-status-attention-signals
Open

feat(status-area): honor SNI Status, attention icon, and live property changes#1427
BrianHotopp wants to merge 4 commits into
pop-os:masterfrom
BrianHotopp:fix-sni-status-attention-signals

Conversation

@BrianHotopp
Copy link
Copy Markdown
Contributor

@BrianHotopp BrianHotopp commented May 29, 2026

Improve StatusNotifierItem (SNI) handling in the status-area applet so tray icons behave correctly for items that vary their status or icon at runtime.

  • Read the SNI Status property and hide Passive items so they no longer consume a panel slot. Status defaults to Active on a missing or throwing Get, so quirky-but-conformant items (JetBrains, Dropbox) are never wrongly hidden.
  • Read AttentionIconName/AttentionIconPixmap and show the attention icon while an item is NeedsAttention, falling back to the normal icon so the panel is never blank.
  • Refresh the icon on NewStatus, NewAttentionIcon, and NewIconThemePath, not just NewIcon, so live property changes are picked up. A failed signal subscription is logged and dropped instead of unwrapping.

Test plan

  • Added an in-crate fake StatusNotifierItem on a private session bus and 16 tests covering the status default/throw/passive cases, attention-icon precedence, and each refresh signal.
  • dbus-run-session -- cargo test -p cosmic-applet-status-area --lib → 16 passed.

  • I have disclosed use of any AI generated code in my commit messages.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

icon_theme_path: Option<PathBuf>,
/// Latest Status. Defaults to "Active" so an item is visible before its
/// first `IconUpdate` arrives — never hide an item that hasn't reported (P1).
status: String,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an enum that represents each possible state.

@mmstick
Copy link
Copy Markdown
Member

mmstick commented May 29, 2026

There's a lot of unnecessary out of context commentary. Could you simplify the description of this PR and simplify the code comments? You must also include the GitHub PR template since that's mandatory. And make sure that each commit does one specific thing and they adhere to the requirements of the AI policy in that PR template.

@leviport
Copy link
Copy Markdown
Member

Also, please include the PR template checklist. It is required.

@BrianHotopp BrianHotopp force-pushed the fix-sni-status-attention-signals branch from 09d50ce to 5d2f5a7 Compare May 29, 2026 16:20
@BrianHotopp
Copy link
Copy Markdown
Contributor Author

Thanks for the review. Simplified the description and code comments, added the PR template, and split into four atomic commits (test scaffolding, read Status + hide Passive, attention icon, refresh-on-change signals). Each commit builds and tests green on its own.

@BrianHotopp BrianHotopp force-pushed the fix-sni-status-attention-signals branch from 5d2f5a7 to 215d8ae Compare May 29, 2026 17:34
BrianHotopp and others added 4 commits May 29, 2026 17:08
Extract `icon_events` to a module-level fn so it can be unit-tested, and
add a fake StatusNotifierItem on a private session bus to drive the
applet's real proxy against. Tests skip cleanly without a session bus;
run with `dbus-run-session -- cargo test -p cosmic-applet-status-area`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The proxy never read Status, so a Passive item still consumed a panel
slot. Read Status (defaulting to "Active" on a missing or throwing Get so
a quirky-but-conformant item is never hidden) and filter Passive items
out of every layout site through a single `visible_menus()`, keeping the
icon/overflow positions and popup anchor math in sync.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AttentionIconName/AttentionIconPixmap were never read, so NeedsAttention
alerts rendered blank or stale. Read them (defensively) and, via the pure
`pick_icon_source`, prefer the attention icon only while status is
"NeedsAttention" and one is present; otherwise fall through to the normal
icon so the panel is never blank.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ath changes

Icon refresh was driven only by NewIcon, so a runtime Status, attention,
or IconThemePath change was missed. Merge all four signals via
stream_select! and refetch on any of them; failed subscriptions log and
drop instead of unwrapping, so one bad registration cannot abort the
subscription task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@BrianHotopp BrianHotopp force-pushed the fix-sni-status-attention-signals branch from 215d8ae to 4b8bd8f Compare May 29, 2026 21:08
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.

3 participants