nova-shell/shell/modules/BluetoothModule.qml

44 lines
1.3 KiB
QML

import QtQuick
import Quickshell
import "." as M
import "../services" as S
import "../applets" as C
M.BarModule {
id: root
spacing: S.Theme.moduleSpacing
active: S.Modules.bluetooth.enable && S.BluetoothService.state !== "unavailable"
tooltip: {
if (S.BluetoothService.state === "connected")
return "Bluetooth: " + S.BluetoothService.device;
if (S.BluetoothService.state === "off")
return "Bluetooth: off";
return "Bluetooth: on";
}
panelNamespace: "nova-bluetooth"
panelContentWidth: 250
panelComponent: Component {
C.BluetoothApplet {
width: parent.width
accentColor: root.accentColor
}
}
Connections {
target: S.BluetoothService
function onDevicesChanged() {
root.keepPanelOpen(500);
}
}
M.BarIcon {
icon: "\uF294"
color: S.BluetoothService.state === "off" ? S.Theme.base04 : root.accentColor
anchors.verticalCenter: parent.verticalCenter
}
M.BarLabel {
visible: S.BluetoothService.state === "connected"
label: S.BluetoothService.device + (S.BluetoothService.batteryPct >= 0 ? " " + S.BluetoothService.batteryPct + "%" : "")
anchors.verticalCenter: parent.verticalCenter
}
}