Skip to content

feat(battery-wireless-devices): add wireless devices battery indicators plugin#912

Open
aslauw wants to merge 12 commits into
noctalia-dev:mainfrom
aslauw:battery-wireless-devices
Open

feat(battery-wireless-devices): add wireless devices battery indicators plugin#912
aslauw wants to merge 12 commits into
noctalia-dev:mainfrom
aslauw:battery-wireless-devices

Conversation

@aslauw

@aslauw aslauw commented Jun 5, 2026

Copy link
Copy Markdown

Battery for Wireless Devices

A customizable bar widget showing battery levels for wireless peripherals. Each device is an icon inside a circular battery ring.

Bar widget

image

Widget settings

image

Data comes from a small standalone scanner (scripts/scan.py); adding a vendor is just a new scan_<source>().
Supported today: Razer (OpenRazer) and Logitech (Solaar), both degrading gracefully if the tool is absent.

How to test

  1. Enable the plugin, add the widget to a bar section.
  2. Open settings → Rescan devices → enable a detected device; it shows in the bar.
  3. Scanner standalone: python3 scripts/scan.py | python3 -m json.tool.

aslauw added 12 commits June 4, 2026 23:01
Bar widget showing battery indicators for connected devices (mouse,
keyboard, headphones, etc.), each rendered as a device icon inside a
circular battery ring.

- scripts/scan.py: normalized JSON data layer probing openrazer + Solaar;
  add a scan_*() and append to SOURCES to support a new device source
- Main.qml: polls scan.py on a timer, exposes live devices, IPC refresh
- BarWidget.qml: one pill per enabled device, theme-aware colors, tooltip,
  click-to-launch, right-click settings menu
- Settings.qml: per-device enable/icon/colors/launch-command, applied live
openrazer intermittently returns a placeholder serial (e.g.
"UNKNOWN_153200B7_0000") instead of the real one, which got saved as
separate, unstable device ids.

- scan.py: skip devices with an empty or "UNKNOWN_*" serial rather than
  minting an unstable id; the device reappears once the serial is readable
- Settings.qml: auto-heal stale offline entries that match a detected
  device by source + name (folding config into the real id), and add a
  per-card delete button to remove cruft manually
Size each pill to the capsule height (smaller than the full bar height)
so the bar centers it, matching the core widgets, instead of filling the
whole bar height. Scale the ring and device icon to the capsule height.
Devices in the settings list can be reordered by dragging a grip handle;
the order (top = left-most / top-most) is persisted as deviceOrder and
honoured by the bar widget. Reuses the core NReorderCheckboxes pattern
(absolute-positioned, uniform-height cards, reorder on release).
NToggle emits toggled(checked) without updating its own checked, so the
global show-percentage value never flipped and commit() kept persisting
the old value. Drive it from a notifiable showPercentageEdit property,
matching the per-device toggle fix.
New "Show charging indicator" option adds a lightning (bolt) icon next to
any device that is currently charging. Persisted as showCharging and
driven by a notifiable mirror property so the toggle applies live.
- README.md with overview, screenshots, requirements, usage, settings
  reference, and how to add a new device source
- MIT LICENSE
- docs/ screenshots (bar + settings)
- manifest author lowercased to "aslauw"
- CLAUDE.md: correct the stale "data comes from BluetoothService" notes
  (data comes only from scripts/scan.py)
- Settings.qml: fix card subtree indentation, drop unused toggle ids
- BarWidget.qml: move barFontSize up with the other properties
- scan.py: docstring battery is always 0-100 (never null)
The openrazer daemon often reports an unstable placeholder serial
(e.g. UNKNOWN_153200B7_0000), especially when run as the systemd user
service, which caused the device to be skipped entirely. Key the device
id on USB vendor:product id instead — stable regardless of how the daemon
is launched. Existing serial-keyed config auto-migrates via the settings
dedup (matched by source + name).
- add i18n/en.json; route all user-facing strings through pluginApi.tr()
- manifest: point repository at noctalia-plugins, add tags
  [Bar, Indicator, System], bump minNoctaliaVersion to 4.6.6
- rename IPC target to plugin:battery-wireless-devices
- rename plugin to "Battery for Wireless Devices"; rewrite install docs
- keep CLAUDE.md accurate (version, IPC target, i18n note)
@aslauw aslauw marked this pull request as ready for review June 5, 2026 09:53
@aslauw aslauw marked this pull request as draft June 8, 2026 08:28
@aslauw aslauw marked this pull request as ready for review June 8, 2026 08:28
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.

1 participant