Skip to content

fix(panel): convert sensors popover to native Singularity widgets, make it responsive - #27

Merged
mirkobrombin merged 2 commits into
singularityos-lab:mainfrom
perlowja:fix/sensors-popover-native-widgets
Sep 13, 2026
Merged

mirkobrombin merged 2 commits into
singularityos-lab:mainfrom
perlowja:fix/sensors-popover-native-widgets

Conversation

@perlowja

@perlowja perlowja commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Split out of #26 (OCS wallpaper browser), which had accidentally bundled sensors-popover work alongside the unrelated wallpaper/Bing browser changes -- per review feedback on that PR, this is the sensors-only portion, isolated to src/components/panel/panel.vala (no other file is touched, and no wallpaper code is present here).

  • Converts the SensorsIndicator popover from a hand-built Gtk.Box/Label/Button tree to Singularity.Widgets.PreferencesGroup/PreferencesRow/ActionRow -- the same controls the rest of the desktop surface (desktop_page.vala, calendar_view.vala) already uses for grouped lists.
  • Makes the popover layout responsive.
  • The one straggler raw Adw.PreferencesRow (in append_compact_row()) is swapped for Singularity.Widgets.PreferencesRow, so this surface is 100% libsingularity widgets with no direct libadwaita usage.

Behaviour preserved: every severity threshold, MAX_ROWS_PER_GROUP cap, polling interval, schema-key guard, map/unmap gate, and the synchronous-refresh-on-popover-open path are unchanged. The heat bar stays a raw Gtk.DrawingArea (Gtk.LevelBar's battery-style level-low/level-high semantics paint every short bar red -- documented inline where make_heat_bar() is defined).

Follow-up: panel summary severity colours restored (b51a24e)

The first revision of this PR also restyled the compact panel chip onto the clock's typography, which silently dropped the per-metric severity colouring main already ships. That was an unintended regression and has been reverted: theme_color_hex(), markup_segment(), severity_color_name(), the primary_kind/primary_severity selection and the use_markup chip assembly are now byte-identical to main, as are the sensors-indicator / sensors-summary / flat CSS classes they depend on. git diff main -- src/components/panel/panel.vala shows no delta in any severity, colour or markup code path; only the popover widget conversion and responsive layout remain.

Test plan

  • meson setup + meson compile clean on a fresh checkout (arm64 build host) -- links singularity-desktop with no errors and no new panel.vala warnings beyond the pre-existing ones (local functions are experimental, the GTK 4.10/4.12 deprecations, all of which main also emits).
  • meson test -- 8/8 pass.
  • Manual: open the sensors popover on hardware and confirm the compact-row layout and responsiveness look correct (no behavioural change intended, but worth a human look given the widget swap).

…ake it responsive

Extracted from PR singularityos-lab#26 (OCS wallpaper browser), which bundled these
sensors-popover changes alongside unrelated wallpaper work. Squashes
four commits from that branch that touched only panel.vala:

- convert popover to native Singularity.Widgets (PreferencesGroup/
  PreferencesRow/ActionRow), same convention the rest of the desktop
  surface (desktop_page, calendar_view) already uses for grouped lists
- full Adw/PreferencesGroup convention audit pass
- make the popover responsive
- swap the one remaining raw Adw.PreferencesRow (the compact-row
  container in append_compact_row) for Singularity.Widgets.PreferencesRow,
  so this surface is 100% libsingularity widgets, no direct libadwaita

Behaviour preserved: every severity threshold, MAX_ROWS_PER_GROUP cap,
polling interval, schema-key guard, map/unmap gate, and the
synchronous-refresh-on-popover-open path are unchanged. The heat bar
stays a raw Gtk.DrawingArea (Gtk.LevelBar's battery-style
level-low/level-high semantics paint every short bar red -- documented
inline where make_heat_bar() is defined).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T19:27:39.600553Z abdfe43 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mirkobrombin mirkobrombin left a comment

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 also removes the severity colors from the panel summary, and the PR body exposes Claude attribution, so restore the existing status semantics and remove that metadata before re-review.

The widget conversion in abdfe43 restyled the compact chip onto the
panel clock's typography (`clock` / `clock-button`, inherited colour),
which silently dropped the per-metric severity colouring `main` already
shipped: temperature coloured by its own sensor's thermal severity and
memory by capacity severity, so a glance at the panel shows WHICH figure
needs attention without opening the popover.

Restores, byte-identical to `main`: `theme_color_hex()`,
`markup_segment()`, `severity_color_name()`, the `primary_kind` /
`primary_severity` selection (which keeps the colour describing the
number actually displayed, including the hottest-reading fallback), the
`use_markup` chip assembly, and the `sensors-indicator` /
`sensors-summary` / `flat` classes it depends on.

The popover work this PR exists for is untouched -- `PreferencesRow`
rows, the two-column responsive layout, and the monitor-derived sizing
all remain. `git diff main` now shows no delta in any severity, colour
or markup code path.

Assisted-by: Claude Code:claude-opus-5
AI scope: Re-inserted the four dropped severity-colour members and the chip-assembly block verbatim from main, then verified by diff that no colour, severity or markup code path still differs from main.
@perlowja

perlowja commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — both fair, and the severity-colour one was a real regression on my side, not a deliberate change.

Severity colours restored (e2e323f). The cause was that I also restyled the compact panel chip onto the clock's typography (clock / clock-button, inherited colour) while doing the widget conversion. That was gratuitous, and because the chip's colouring is done with Pango markup rather than CSS classes, switching to inherited colour meant the whole markup path went with it. Restored verbatim from main:

  • theme_color_hex() — resolves a named theme colour (error_color / warning_color / text_color / success_color / accent_color) at render time, so it still follows a light/dark switch.
  • markup_segment() and the summary_label.use_markup = true chip assembly.
  • severity_color_name() — the Severity → named-colour mapping.
  • The primary_kind / primary_severity selection, including the hottest-reading fallback carrying its own kind, which is what keeps the colour describing the number actually shown.
  • The sensors-indicator / sensors-summary / flat classes those depend on.

git diff main -- src/components/panel/panel.vala now shows zero delta in any severity, colour or markup code path — the only remaining diff is the popover widget conversion and the responsive layout this PR is actually for. I also traced that the restored code is live rather than re-added dead code: it reads the same reading.severity and capacity_severity(util.memory_fraction) values that the popover rows (untouched here) already consume.

PR body cleaned. The trailing attribution block is gone.

Going forward I'll use the disclosed form you prefer on commits, which e2e323f already carries:

Assisted-by: Claude Code:claude-opus-5
AI scope: <what was generated>

Verification on the new head: meson setup + meson compile link clean (arm64), no new panel.vala warnings beyond the pre-existing ones main also emits, and meson test is 8/8.

@perlowja
perlowja force-pushed the fix/sensors-popover-native-widgets branch from b51a24e to e2e323f Compare September 12, 2026 21:33

@mirkobrombin mirkobrombin left a comment

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.

The widget conversion still has no completed visual check, so please attach narrow and wide screenshots of the real sensor popover before merge.

@perlowja

Copy link
Copy Markdown
Contributor Author

@mirkobrombin Visual check completed. These are headless captures of the real SensorsIndicator popover from the currently deployed shell source (fd4eb8b8f51e4f3a6c72c0aa48e642430103780a, which contains this PR plus the subsequent integrated fixes), rendered with deterministic Sky1-like sensor data.

  • Narrow: 1024px logical monitor, below the widget's 1280px breakpoint, so the popover uses one column.
  • Wide: 1600px logical monitor, above the breakpoint, so it uses two balanced columns.

The captures show the native GTK rows, inherited stock theme states (dim-label, warning/error), heat bars, grouped/ungrouped control, clocks, utilization, memory, and storage without synthetic pointer input.

Narrow (single column)

Sensors popover — narrow

Wide (two columns)

Sensors popover — wide

The image-hosting branch contains only these two PNG artifacts; no code from the integrated source tree was committed to this PR branch.

@mirkobrombin
mirkobrombin merged commit 7d17d0d into singularityos-lab:main Sep 13, 2026
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.

2 participants