Files
Aurora/config/aurora/modules/Bluetooth.qml
2026-03-15 20:08:48 -05:00

101 lines
2.5 KiB
QML

import Quickshell // for PanelWindow
import QtQuick // for Text
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Io
import Quickshell.Widgets
import Quickshell.Hyprland
import Quickshell.Bluetooth
ColumnLayout {
anchors.fill: parent
id: root
spacing: 0
ClippingWrapperRectangle {
radius: 5
implicitWidth: parent.width - 2 * Layout.margins
implicitHeight: 30
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.margins: 5
color: Pywal.colors.color11
RowLayout {
Text {
text: 'Bluetooth'
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.margins: 5
color: Pywal.colors.color0
}
Switch {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
//Layout.margins: 5
checked: Bluetooth.defaultAdapter.enabled
onClicked: {
Bluetooth.defaultAdapter.enabled = checked
scroll.visible = checked
}
}
}
}
ScrollView {
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.margins: 5
implicitWidth: parent.width - 4 * Layout.margins
implicitHeight: parent.height / 2
id: scroll
ColumnLayout {
spacing: 0
Repeater {
id: rep
model: Bluetooth.devices.values
ClippingWrapperRectangle {
radius: 5
color: Pywal.colors.color4
implicitWidth: root.width - 3 * scroll.x
implicitHeight: 40
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.margins: 5
RowLayout {
Text {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.margins: 5
text: rep.model[index].name
color: Pywal.colors.color0
}
Button {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.rightMargin: 5
text: 'Connect'
onClicked: rep.model[index].connected = !rep.model[index].connected
}
}
}
}
}
}
}