wactioncenter: bluetooth menu

This commit is contained in:
end-4
2025-11-22 21:55:47 +01:00
parent 7613bba393
commit 55961ae079
22 changed files with 451 additions and 69 deletions
@@ -44,20 +44,7 @@ WindowDialog {
animateAppearance: false
model: ScriptModel {
values: [...Bluetooth.devices.values].sort((a, b) => {
// Connected -> paired -> others
let conn = (b.connected - a.connected) || (b.paired - a.paired);
if (conn !== 0) return conn;
// Ones with meaningful names before MAC addresses
const macRegex = /^([0-9A-Fa-f]{2}-){5}[0-9A-Fa-f]{2}$/;
const aIsMac = macRegex.test(a.name);
const bIsMac = macRegex.test(b.name);
if (aIsMac !== bIsMac) return aIsMac ? 1 : -1;
// Alphabetical by name
return a.name.localeCompare(b.name);
})
values: BluetoothStatus.friendlyDeviceList
}
delegate: BluetoothDeviceItem {
required property BluetoothDevice modelData