Add panel sensor selector to preferences#572
Open
samirhvbr wants to merge 1 commit into
Open
Conversation
- New "Panel" page in preferences lists every sensor the extension has discovered, grouped by category, each with a switch that toggles its visibility in the top bar (writes hot-sensors). Sensor selection no longer requires hunting through the dropdown menu. - extension.js publishes discovered sensors via a new `available-sensors` setting so the (separate) prefs process can build that list, and redraws the panel when hot-sensors changes from the selector. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 new Panel page to the extension preferences that lists every sensor Vitals has discovered, grouped by category, each with a switch to show or hide it in the top bar.
Today the only way to change which sensors appear in the panel is to open the Vitals dropdown menu and toggle them one at a time. This makes that selection discoverable and manageable directly from the preferences window.
What changed
Panelpage (_buildPanelSensorsPage). It reads the discovered sensors, buckets them by category, and renders oneAdw.SwitchRowper sensor. Toggling a row adds/removes that sensor from thehot-sensorssetting (the list the panel renders). The existing_default_icon_placeholder invariant is preserved (shown only when nothing else is selected). The pre-existing, first page is now titled General.available-sensorssetting so the preferences window (a separate process) can build the list. Achanged::hot-sensorshandler redraws the panel when the selection changes from the new page.available-sensorskey (JSON string) used to hand the discovered-sensor list to the preferences process.How it works
prefsand the running extension are separate processes, so they communicate through GSettings:available-sensors.changed::available-sensorswhen new sensors appear.hot-sensors; both the panel and the switches listen forchanged::hot-sensorsand stay in sync, with a guard against feedback loops. Comparing the desired vs. shown sets keeps the panel redraw timing-independent.Notes
close-requestto avoid leaks.How to test