feat: resource monitor widget for bar - #136
Open
flathead wants to merge 14 commits into
Open
Conversation
Adds a compact system resource monitor that can be displayed either in
the dashboard (existing behaviour) or in the bar. When placed in the
bar, the widget shows CPU/RAM/GPU/Disk usage inline with temperature
annotations; clicking it opens a detail popup via BarPopup.
New settings under System > System Resources:
- Enable/disable resource monitor globally
- Display Location: Dashboard (default) | Bar
- Bar Position: Left (after workspaces) | Right (before presets)
- Visible Items: toggle CPU, RAM, GPU, Disk independently
- Save button in titlebar; settings buffered until saved
- Status text shows "Unsaved changes" / "Saved" feedback
Config stored in system.json under resources.{enabled,location,barSide,show}.
SystemResources monitor process now also runs when bar mode is active.
I18n keys used via tr() helper with English fallbacks for upstream compat.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…izing Loader uses implicitWidth/implicitHeight of the loaded item to determine its own size. The widget only had Layout.preferredWidth/Height which are Layout-attached hints for the parent layout, not sizing hints for Loader. Result: Loader was 0×0, widget invisible even when active. Fix: add implicitWidth: bg.implicitWidth and implicitHeight: 36 on the root Item so Loader correctly sizes itself and the widget becomes visible. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fixed-width numeric Text via TextMetrics ("100%"/"100°") so chip width
no longer jitters as values change; values right-aligned within fixed slot
- Popup contentWidth now matches panel width (bg.width) instead of 220px
- All icon/text colors transition to theme's over-primary color (bg.item)
when popup is open, with ColorAnimation — matches other bar buttons
- Dashboard MetricsTab tab hidden and unloaded when location="bar";
tabModel is computed dynamically (excludes heartbeat icon in bar mode);
redirects currentTab 2→0 when switching to bar mode
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ling - Add "Both" location option: resource monitor shown in bar AND dashboard simultaneously; BarContent/Dashboard/SystemResources all updated - Fix bar panel width stability: use Layout.preferredWidth (not width) on numeric Text inside RowLayouts so the layout's implicitWidth is stable - Fix SegmentedSwitch: Layout.fillWidth: true on buttons → equal-width segments that fill the available space instead of shrinking to text Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…side SegmentedSwitch looked out of place. SelectorRow uses StyledRect with variant primary/focus/common — the same pattern as ShellPanel and CompositorPanel. Options fill equal width, selected item gets primary color, hover gets focus, unselected is common. DemiBold font weight on selected item for extra clarity.
Replaces four ToggleRow checkboxes with a Flow of StyledRect buttons. Active (shown) items get variant primary, inactive get common, hover gets focus — same pattern as SelectorRow. Width fits the label, wraps to next line if needed.
When location is 'both', Visible Items section splits into two labeled groups — Dashboard and Bar — each controlling their own show.* and show.bar* config keys independently.
- MetricsTab now reads show.cpu/ram/gpu/disk from config — items were always visible before, settings had no effect - Added show.dashTemp / show.barTemp config keys for temperature display - BarResourceMonitor respects show.barTemp for all temperature elements - SystemPanel adds temperature toggle buttons (per dashboard / per bar)
- SystemPanel: use else if in toggle onClick chains (no wasted comparisons) - BarResourceMonitor: implement vertical bar mode — compact ColumnLayout chip, Layout.fillWidth, dynamic implicitHeight based on orientation - BarContent: add resource monitor Loaders to vertical bar layout (top position for barSide=left, bottom for barSide=right) - BarResourceMonitor: show "No metrics enabled" message in popup when all items are hidden, preventing a 0-height popup - SystemResources: document trade-off of continuous process when location includes bar
Chip: replace horizontal RowLayout per metric with Column (icon above value, both centered) so the widget looks correct in a vertical bar. Popup: use fixed contentWidth=240 in vertical mode instead of bg.width (~36px), which was clipping all labels to icon-only width.
Add pctMetricsSmall TextMetrics (fontSize -2) for vertical chip items. Set Layout.preferredWidth: pctWidthSmall and horizontalAlignment: Center on both icon and value texts so width is fixed and nothing shifts when the percentage value changes digits.
In vertical bar the chip was reporting implicitWidth = itemsCol.width+16 (~51px) which widened the entire bar above other elements (36px). Set implicitWidth and Layout.preferredWidth to 0 in vertical mode so the bar width is determined by other elements; Layout.fillWidth handles the actual sizing.
Owner
|
Screenshots please |
…onitor # Conflicts: # modules/services/SystemResources.qml
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.
Adds a system resource monitor widget to the bar, configurable via System → System Resources settings.
What's new
Bar widget
Location setting
Visible items
Settings UI
Config changes
New keys in
resources.show:barCpu,barRam,barGpu,barDisk— visibility in bardashTemp,barTemp— temperature display per locationAll new keys default to
trueand are deep-merged by ConfigValidator, so existing configs are unaffected.Screenshots
Install as a mod
Requires the native manager from PR #230. Paste the package link into Settings → Mods → Package source:
The package needs
community.i18n(PR #134) for its Settings and metrics strings. The details pane marks that requirement as missing, disabled, or ready, and Install required mods fetches i18n, enables it first, and leaves this package for you to enable. The same steps from the CLI:The package targets the current Go-backed
systemmonitorservice. Its subscription stays inactive unless the Dashboard metrics tab is open or the bar monitor is configured to be visible. It does not restore the old Python polling process.Merge into Ambxst core
For core review, take this PR's branch: the feature as ordinary Ambxst source on
dev.The package patch is a separate artifact. It targets a tree that already carries the mod manager from PR #230 and the
community.i18npackage, because that is the only tree a mod can be installed on. To reproduce exactly what the manager composes:git remote add flathead https://github.com/flathead/Ambxst.git git fetch flathead feature/mod-manager git switch -c mods/bar-resource-monitor flathead/feature/mod-manager git apply --3way ambxst-mod-i18n/patches/feature.patch git apply --3way ambxst-mods/packages/bar-resource-monitor/patches/feature.patch go test ./... go vet ./...It adds
BarResourceMonitor.qml, registers it in the bar, and extends the existing resources Config, service, Dashboard visibility rules, metrics view, and System settings. This PR's branch already callsI18n.t()in two places, so it expects PR #134 too; the package only states that requirement instead of leaving it implied. The mod uses the same backend subscription and QML components that core would use.Package parity
The package in flathead/ambxst-mods and this branch carry the same feature code, including the Go-backed subscription and the
monitoringActiverule that keeps it dormant.SystemPanel.qmlandMetricsTab.qmldiffer only where the package wraps strings forcommunity.i18n, and the Config files differ in their registration lines.