Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell/plugins/panels/bluetooth/Model.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function deviceLabel(device) {
if (!device) return ""
return String(device.deviceName || device.name || "").trim()
return String(device.name || device.deviceName || "").trim()
}

function toArray(values) {
Expand Down
10 changes: 9 additions & 1 deletion test/shell.d/bluetooth-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,16 @@ assertDeepEqual(
{ address: '1', name: 'Deadbeef', deviceName: '', connected: false, state: -1, batteryAvailable: false, battery: 0, pairing: false },
'bluetooth projects device rows with primitives only'
)
// BlueZ Alias is the user-facing rename and arrives as Quickshell's writable
// `name`; the read-only `deviceName` is the hardware-advertised Name, which is
// only what to show when nothing renamed the device.
assertEqual(
bluetooth.deviceLabel(bluetooth.deviceRow({ name: 'Generic', deviceName: 'MX Master 3S', address: '2', connected: true })),
bluetooth.deviceLabel(bluetooth.deviceRow({ name: 'My Custom Name', deviceName: 'MX Master 3S', address: '2', connected: true })),
'My Custom Name',
'bluetooth shows the alias ahead of the hardware name'
)
assertEqual(
bluetooth.deviceLabel(bluetooth.deviceRow({ deviceName: 'MX Master 3S', address: '2', connected: true })),
'MX Master 3S',
'bluetooth keeps deviceName in row projections so labels survive QObject-free rows'
)
Expand Down