bluetooth: refractor and fix wrong icon

This commit is contained in:
end-4
2025-08-29 12:06:01 +07:00
parent b52440bcc1
commit d239ab6b1f
4 changed files with 27 additions and 16 deletions
@@ -0,0 +1,19 @@
pragma Singleton
pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Bluetooth
import Quickshell.Io
import QtQuick
/**
* Network service with nmcli.
*/
Singleton {
id: root
readonly property bool enabled: Bluetooth.defaultAdapter?.enabled
readonly property BluetoothDevice firstActiveDevice: Bluetooth.defaultAdapter?.devices.values.find(device => device.connected) ?? null
readonly property int activeDeviceCount: Bluetooth.defaultAdapter?.devices.values.filter(device => device.connected).length ?? 0
readonly property bool connected: Bluetooth.devices.values.some(d => d.connected)
}