142 lines
4.0 KiB
QML
142 lines
4.0 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
|
|
|
|
ClippingWrapperRectangle {
|
|
|
|
|
|
radius: 5
|
|
implicitWidth: 30; implicitHeight: 30
|
|
Button {
|
|
id: button
|
|
text: ""
|
|
font.pointSize: 16
|
|
|
|
onClicked: {
|
|
menu.visible = true
|
|
grab.active = true
|
|
}
|
|
implicitHeight: parent.height
|
|
}
|
|
|
|
required property PanelWindow window
|
|
required property real popupOffset
|
|
id: root
|
|
|
|
PopupWindow {
|
|
|
|
id: menu
|
|
|
|
anchor.window: window
|
|
anchor.rect.x: popupOffset - width
|
|
anchor.rect.y: 50
|
|
implicitWidth: 250
|
|
implicitHeight: 150
|
|
visible: false
|
|
|
|
color: "transparent"
|
|
|
|
ClippingWrapperRectangle {
|
|
radius: 5
|
|
|
|
implicitHeight: parent.height - 20
|
|
implicitWidth: parent.width
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
ClippingWrapperRectangle {
|
|
radius: 5
|
|
implicitWidth: parent.width - 2 * Layout.margins
|
|
implicitHeight: 30
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
Layout.margins: 5
|
|
color: "#ff3333aa"
|
|
|
|
RowLayout {
|
|
Text {
|
|
text: 'Bluetooth'
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
|
Layout.margins: 5
|
|
}
|
|
|
|
Switch {
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
//Layout.margins: 5
|
|
checked: Bluetooth.defaultAdapter.enabled
|
|
onClicked: Bluetooth.defaultAdapter.enabled = checked
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
ScrollView {
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
Layout.margins: 5
|
|
|
|
implicitWidth: parent.width - 4 * Layout.margins
|
|
implicitHeight: menu.height / 2
|
|
|
|
id: scroll
|
|
|
|
ColumnLayout {
|
|
spacing: 0
|
|
|
|
Repeater {
|
|
|
|
id: rep
|
|
|
|
model: Bluetooth.devices.values
|
|
|
|
ClippingWrapperRectangle {
|
|
radius: 5
|
|
color: "#ff3333aa"
|
|
|
|
implicitWidth: menu.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
|
|
}
|
|
|
|
Button {
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
Layout.rightMargin: 5
|
|
text: 'Connect'
|
|
|
|
onClicked: rep.model[index].connected = !rep.model[index].connected
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
HyprlandFocusGrab {
|
|
id: grab
|
|
windows: [ menu ]
|
|
onCleared: menu.visible = false
|
|
}
|
|
}
|
|
}
|