This commit is contained in:
2026-03-15 20:08:48 -05:00
parent 9871af127a
commit 6ea4782a80
15 changed files with 610 additions and 491 deletions

View File

@@ -7,135 +7,94 @@ 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
}
ColumnLayout {
required property PanelWindow window
required property real popupOffset
anchors.fill: parent
id: root
PopupWindow {
id: menu
spacing: 0
anchor.window: window
anchor.rect.x: popupOffset - width
anchor.rect.y: 50
implicitWidth: 250
implicitHeight: 150
visible: false
ClippingWrapperRectangle {
radius: 5
implicitWidth: parent.width - 2 * Layout.margins
implicitHeight: 30
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.margins: 5
color: Pywal.colors.color11
color: "transparent"
ClippingWrapperRectangle {
radius: 5
RowLayout {
Text {
text: 'Bluetooth'
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.margins: 5
color: Pywal.colors.color0
}
implicitHeight: parent.height - 20
implicitWidth: parent.width
ColumnLayout {
Switch {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
//Layout.margins: 5
checked: Bluetooth.defaultAdapter.enabled
onClicked: {
Bluetooth.defaultAdapter.enabled = checked
scroll.visible = checked
}
}
}
spacing: 0
}
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
implicitWidth: parent.width - 2 * Layout.margins
implicitHeight: 30
color: Pywal.colors.color4
implicitWidth: root.width - 3 * scroll.x
implicitHeight: 40
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.margins: 5
color: "#ff3333aa"
RowLayout {
Text {
text: 'Bluetooth'
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.margins: 5
text: rep.model[index].name
color: Pywal.colors.color0
}
Switch {
Button {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
//Layout.margins: 5
checked: Bluetooth.defaultAdapter.enabled
onClicked: Bluetooth.defaultAdapter.enabled = checked
Layout.rightMargin: 5
text: 'Connect'
onClicked: rep.model[index].connected = !rep.model[index].connected
}
}
}
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
}
}
}