1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

feat: Only colour Bluetooth icon in DankBar if a device is connected (#497)

This commit is contained in:
Mattias
2025-10-20 04:35:31 +02:00
committed by GitHub
parent 1feb77aadb
commit b35198c710
2 changed files with 11 additions and 2 deletions

View File

@@ -67,7 +67,7 @@ Rectangle {
DankIcon {
name: "bluetooth"
size: Theme.barIconSize(barThickness)
color: BluetoothService.enabled ? Theme.primary : Theme.outlineButton
color: BluetoothService.connected ? Theme.primary : Theme.outlineButton
anchors.horizontalCenter: parent.horizontalCenter
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
}
@@ -169,7 +169,7 @@ Rectangle {
name: "bluetooth"
size: Theme.barIconSize(barThickness)
color: BluetoothService.enabled ? Theme.primary : Theme.outlineButton
color: BluetoothService.connected ? Theme.primary : Theme.outlineButton
anchors.verticalCenter: parent.verticalCenter
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
}

View File

@@ -15,6 +15,15 @@ Singleton {
readonly property bool enabled: (adapter && adapter.enabled) ?? false
readonly property bool discovering: (adapter && adapter.discovering) ?? false
readonly property var devices: adapter ? adapter.devices : null
readonly property bool connected: {
if (!adapter || !adapter.devices) {
return false
}
let isConnected = false
adapter.devices.values.forEach(dev => { if (dev.connected) isConnected = true })
return isConnected
}
readonly property var pairedDevices: {
if (!adapter || !adapter.devices) {
return []