Skip to content

feat(control-center): show Bluetooth battery in quick tile - #3160

Merged
bbedward merged 1 commit into
AvengeMedia:masterfrom
0xdeafbeef:0xdeafbeef/push-vrwrrvxnwnnw
Aug 25, 2026
Merged

feat(control-center): show Bluetooth battery in quick tile#3160
bbedward merged 1 commit into
AvengeMedia:masterfrom
0xdeafbeef:0xdeafbeef/push-vrwrrvxnwnnw

Conversation

@0xdeafbeef

Copy link
Copy Markdown
Contributor

Description

Shows the connected Bluetooth device battery level in the Control Center tile when available.

Type of change

  • New feature

Related issues

None.

Screenshots / video

Screenshot from 2026-08-23 20-33-48

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • QML changes: ran make lint-qml with no new warnings

@0xdeafbeef

Copy link
Copy Markdown
Contributor Author

I can make it toggleable from the settings if you want. But it utilizes free space, so I see 0 problems, only value :)

@bbedward

Copy link
Copy Markdown
Collaborator

/claude review

Comment on lines +564 to +565
if (primaryDevice.batteryAvailable)
return `${name} • ${Math.round(primaryDevice.battery * 100)}%`;

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.

Missing the battery > 0 guard the rest of the codebase uses (BluetoothService.qml:75, BluetoothDetail.qml:365). BlueZ reports batteryAvailable true with battery == 0 for devices that don't actually publish a level, so this shows Device • 0% and returns early, skipping the UPower fallback below that may have the real value.

Suggested change
if (primaryDevice.batteryAvailable)
return `${name}${Math.round(primaryDevice.battery * 100)}%`;
if (primaryDevice.batteryAvailable && primaryDevice.battery > 0)
return `${name}${Math.round(primaryDevice.battery * 100)}%`;

@claude

claude Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Claude review

Looks good — one minor consistency issue, no blockers.

  • Missing battery > 0 guard on the BlueZ battery path, quickshell/Modules/ControlCenter/Components/DragDropGrid.qml:564

Checked: binding reactivity of secondaryText, BatteryService.bluetoothDevices shape/name matching (mirrors the existing BluetoothDetail.qml pattern), imports, I18n rules, no catalog files touched. Model: claude-opus-5.

@0xdeafbeef
0xdeafbeef force-pushed the 0xdeafbeef/push-vrwrrvxnwnnw branch from 85de4e8 to c1aeff4 Compare August 25, 2026 21:11
@0xdeafbeef

Copy link
Copy Markdown
Contributor Author

/claude review

Display the selected device as `name • N%` when battery information is available, while preserving the existing name-only fallback.
@0xdeafbeef
0xdeafbeef force-pushed the 0xdeafbeef/push-vrwrrvxnwnnw branch from c1aeff4 to 3616fea Compare August 25, 2026 21:31
@0xdeafbeef

Copy link
Copy Markdown
Contributor Author

@bbedward I've added a comment with links to the Quickshell and BlueZ docs. I actually saw 0% reported while testing with connected headphones, so I kept it as a valid value instead of treating it as unavailable. I also updated the existing bluetooth details check to follow the same behavior

@bbedward

Copy link
Copy Markdown
Collaborator

/claude review

@claude

claude Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found.

The battery > 0 question from the previous run was addressed by the author with docs links and applied consistently to BluetoothDetail.qml too — batteryAvailable reflects whether BlueZ exposes org.bluez.Battery1, so a real 0% is now shown instead of being swallowed by the UPower fallback. Nothing new to raise.

Checked: binding reactivity of secondaryText and the btBattery property, BatteryService.bluetoothDevices element shape (name is always a string, so the toLowerCase() matching cannot throw), the Math.round(battery * 100) scaling against Quickshell's 0–1 range, qs.Services import availability in DragDropGrid.qml, no new user-facing literals needing I18n.tr(), no translation catalogs touched, and that the remaining battery > 0 in BluetoothService.allDevicesWithBattery has no consumers so the divergence is inert. Model: claude-opus-5.

@bbedward
bbedward merged commit 34cf6e6 into AvengeMedia:master Aug 25, 2026
1 check passed
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