Skip to content

Make model-usage's bar icon swappable - #6570

Closed
monorkin wants to merge 1 commit into
quattrofrom
swappable-icon-for-model-usage-plugin
Closed

monorkin wants to merge 1 commit into
quattrofrom
swappable-icon-for-model-usage-plugin

Conversation

@monorkin

@monorkin monorkin commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The new icon looks clean, but the old one was quite useful because it would tell you at a glance what your usage was - like the battery or wifi icons do. This PR adds the ability to swap between the two icon styles with a right-click menu.

screenrecording-2026-08-06_09-53-58.mp4

The design is inspired by the tray icons right-click menu. The default icon is the robot.

Copilot AI balanced review requested due to automatic review settings August 6, 2026 08:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds selectable robot or usage-percentage icons to the model-usage bar widget.

Changes:

  • Adds a right-click icon-style menu with refresh.
  • Persists the selected style in shell settings.
  • Documents the new setting and interactions.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
shell/plugins/model-usage/Panel.qml Implements icon styles, menu, persistence, and usage chips.
shell/plugins/model-usage/manifest.json Defines the new style setting.
shell/plugins/model-usage/README.md Documents settings and interactions.
shell/plugins/bar/README.md Updates the widget interaction reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread shell/plugins/model-usage/Panel.qml Resolved
Comment thread shell/plugins/model-usage/Panel.qml Resolved
Copilot AI review requested due to automatic review settings August 6, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (2)

test/shell.d/model-usage-icon-style-test.sh:27

  • These persistence checks only match source text; they never instantiate the QML, call setIconStyle, or observe updateEntryInline, so they pass even when the interaction is broken at runtime. Extend the existing bar-widget QML contract fixture to invoke both style choices and assert the effective style, preserved nested settings, and captured persistence payload.
assert(/for \(var key in root\.settings\) if \(key !== "id"\) entry\[key\] = root\.settings\[key\]/.test(panelSource), 'model-usage carries the existing settings into the persisted entry')
assert(/entry\.barIconStyle = style[\s\S]*root\.settings = entry[\s\S]*updateEntryInline/.test(panelSource), 'model-usage applies the picked style locally and writes it to shell.json')

shell/plugins/model-usage/Panel.qml:24

  • The style menu is separate from Panel.opened, but the inherited canonical close() only hides the main panel. Consequently, after menu() or a right-click opens this popup, both omarchy-shell ... close and shell hide leave it visible (Bar.hideBarWidget calls the widget's close()). Override close() to clear styleMenuOpen as well as hiding the panel controller, matching other widgets that own multiple popups.
  property bool styleMenuOpen: false

@ReynkeDeVos

Copy link
Copy Markdown

I like this! But I’d prefer the provider icons to align with the other bar icons and use the same monochrome styling: black or white, depending on the theme.

@rlimberger rlimberger mentioned this pull request Aug 6, 2026
4 of 7 tasks
@dhh

dhh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

I like the idea, but we don't need a menu for this. Just have right-click do the toggle between the icons. Needs to be updated for the new agent panel too.

@dhh

dhh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Heads up: #6603 just landed on quattro and restructured this whole area, so this PR needs a rework before it can merge.

The model-usage plugin is gone. It's been renamed to omarchy.agents (shell/plugins/agents/), and the panel is now strictly a display: it watches JSON records under ~/.local/state/omarchy/agents/usage/ and draws whatever appears there. All the in-plugin machinery this PR touches — providers/*.qml adapters and scripts/*_usage_scanner.py — no longer exists.

Usage collection now lives in standalone collectors in bin/. One omarchy-agent-usage-<agent> script per agent prints a complete, display-ready usage record (identity, tier, status, rate limits, today/week/all-time stats), and omarchy-agent-usage-update runs every collector it finds and writes the records atomically to the state directory.

The upside: adding an agent no longer touches the panel at all. Ship a collector that prints the record contract, optionally add an assets/<id>.svg mark (with an -light twin if it needs one for light surfaces), and the panel gains a tab on its own. See shell/plugins/agents/README.md for the contract and the claude/codex collectors in bin/ as reference implementations — #6604 (Cursor) is a good example of a provider PR in the new style.

If you'd like to carry this forward, rebase on quattro and rework it against the new omarchy.agents panel — the change may look quite different there, or may already be moot. Happy to answer questions here.

— Claude Fable 5, written on behalf of @dhh

Right-clicking on the icon swaps between the robot icon and the old usage metrics
Copilot AI review requested due to automatic review settings August 7, 2026 17:20
@monorkin
monorkin force-pushed the swappable-icon-for-model-usage-plugin branch from 6722432 to ae5c3a3 Compare August 7, 2026 17:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (2)

shell/plugins/agents/Panel.qml:693

  • On transparent bars this chooses the Codex SVG variant from the configured bar background, even though that background is not rendered. Bar.qml instead computes barForeground from the wallpaper (Bar.qml:779-815), so a light wallpaper with a dark configured background selects the white Codex mark and makes it disappear. Derive the effective surface from the contrast-aware foreground when the bar is transparent.
      surfaceColor: root.bar ? root.bar.background : Color.bar.background

shell/plugins/agents/Panel.qml:289

  • The PR description promises a right-click menu for choosing either icon style, but this handler changes the style immediately and no menu is introduced. That is materially different interaction behavior (and the attached design can no longer be reached); either restore the described menu or update the PR description/demo to make the direct toggle the intended contract.
    if (buttonCode === Qt.RightButton) toggleIconStyle()

@monorkin

monorkin commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@dhh changed it to swap on right-click and updated everything to work with the agents panel.
Brilliant simplification!

screenrecording-2026-08-07_19-20-53.mp4

@MirasMustimov

Copy link
Copy Markdown
Contributor

@monorkin this is nice!

@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
@dhh

dhh commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for this! The agents panel was redesigned in #13770 into a single page with every agent and account at once, and the bar icon's alarm state now looks at every agent. Whether the bar should show usage itself is still an open question (#10175), so closing this one as written for the old menu.

@dhh dhh closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants