65 lines
1.3 KiB
QML
65 lines
1.3 KiB
QML
import Quickshell
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
import "../constants"
|
|
import "../services"
|
|
|
|
Text {
|
|
id: root
|
|
|
|
required property TopBar parentWindow;
|
|
|
|
// Nerd Font Bluetooth icon (nf-fa-bluetooth)
|
|
// cheat sheet: https://www.nerdfonts.com/cheat-sheet
|
|
// TODO make custom floating panel with animation and buttons to connect/disconnect devices
|
|
property string iconGlyph: "\udb80\udcaf"
|
|
property string connectedIconGlyph: "\udb80\udcb1"
|
|
property string disconnectedIconGlyph: "\udb80\udcaf"
|
|
|
|
property BluetoothService bluetoothService: BluetoothService {
|
|
onDevicesFound: function(devices) {
|
|
if (devices.length > 0) {
|
|
root.iconGlyph = root.connectedIconGlyph;
|
|
root.color = Colors.md3.on_primary_fixed;
|
|
} else {
|
|
root.iconGlyph = root.disconnectedIconGlyph;
|
|
root.color = Colors.md3.primary;
|
|
}
|
|
}
|
|
}
|
|
|
|
text: iconGlyph
|
|
color: Colors.md3.on_primary_fixed
|
|
|
|
font {
|
|
family: Constants.fontFamily
|
|
pixelSize: Constants.fontSize
|
|
bold: true
|
|
}
|
|
|
|
Process {
|
|
id: bluemanManagerProcess
|
|
command: ["blueman-manager"]
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
|
|
onClicked: {
|
|
bluemanManagerProcess.running = true;
|
|
popupWindow.visible = true;
|
|
}
|
|
}
|
|
|
|
PopupWindow {
|
|
id: popupWindow
|
|
visible: false
|
|
implicitWidth: 200
|
|
implicitHeight: 100
|
|
anchor.window: parentWindow
|
|
}
|
|
}
|