mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
feat: Only colour Bluetooth icon in DankBar if a device is connected (#497)
This commit is contained in:
@@ -67,7 +67,7 @@ Rectangle {
|
|||||||
DankIcon {
|
DankIcon {
|
||||||
name: "bluetooth"
|
name: "bluetooth"
|
||||||
size: Theme.barIconSize(barThickness)
|
size: Theme.barIconSize(barThickness)
|
||||||
color: BluetoothService.enabled ? Theme.primary : Theme.outlineButton
|
color: BluetoothService.connected ? Theme.primary : Theme.outlineButton
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
|
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ Rectangle {
|
|||||||
|
|
||||||
name: "bluetooth"
|
name: "bluetooth"
|
||||||
size: Theme.barIconSize(barThickness)
|
size: Theme.barIconSize(barThickness)
|
||||||
color: BluetoothService.enabled ? Theme.primary : Theme.outlineButton
|
color: BluetoothService.connected ? Theme.primary : Theme.outlineButton
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
|
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ Singleton {
|
|||||||
readonly property bool enabled: (adapter && adapter.enabled) ?? false
|
readonly property bool enabled: (adapter && adapter.enabled) ?? false
|
||||||
readonly property bool discovering: (adapter && adapter.discovering) ?? false
|
readonly property bool discovering: (adapter && adapter.discovering) ?? false
|
||||||
readonly property var devices: adapter ? adapter.devices : null
|
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: {
|
readonly property var pairedDevices: {
|
||||||
if (!adapter || !adapter.devices) {
|
if (!adapter || !adapter.devices) {
|
||||||
return []
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user