From c0125912b1c6780aaad9e92ad24db299a4361a7e Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Sat, 26 Jul 2025 13:54:07 -0400 Subject: [PATCH] move bluetooth and create popup menu --- modules/bar/Bar.qml | 3 +- .../components/{ => bluetooth}/Bluetooth.qml | 22 ++++++++++---- .../components/bluetooth/BluetoothMenu.qml | 30 +++++++++++++++++++ 3 files changed, 48 insertions(+), 7 deletions(-) rename modules/bar/components/{ => bluetooth}/Bluetooth.qml (60%) create mode 100644 modules/bar/components/bluetooth/BluetoothMenu.qml diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 3cfbb46..66eae2c 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -1,10 +1,11 @@ +import qs.config import QtQuick import Quickshell import "components" +import "components/bluetooth" import "components/hyprland" import "components/mpris" import "components/tray" -import "../../config/" Scope { PanelWindow { diff --git a/modules/bar/components/Bluetooth.qml b/modules/bar/components/bluetooth/Bluetooth.qml similarity index 60% rename from modules/bar/components/Bluetooth.qml rename to modules/bar/components/bluetooth/Bluetooth.qml index 9b4174c..b39e7b8 100644 --- a/modules/bar/components/Bluetooth.qml +++ b/modules/bar/components/bluetooth/Bluetooth.qml @@ -1,14 +1,16 @@ -import "../../../config/" -import "../../../constants/" -import "../../../styled/" +import qs.config +import qs.constants +import qs.styled Clickable { - id: clickable + id: root implicitWidth: text.width implicitHeight: Dimensions.bluetooth.height - onClicked: {} + onClicked: { + popup.opened = !popup.opened; + } StyledText { id: text @@ -18,7 +20,7 @@ Clickable { font.bold: true text: Icons.bluetooth - color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent + color: root.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent anchors.verticalCenter: parent.verticalCenter topPadding: Dimensions.bluetooth.verticalPadding @@ -26,4 +28,12 @@ Clickable { leftPadding: Dimensions.bluetooth.horizontalPadding rightPadding: Dimensions.bluetooth.horizontalPadding } + + BluetoothMenu { + id: popup + + anchor.item: root + anchor.rect.x: root.width / 2 - width / 2 + anchor.rect.y: root.height + 8 + } } diff --git a/modules/bar/components/bluetooth/BluetoothMenu.qml b/modules/bar/components/bluetooth/BluetoothMenu.qml new file mode 100644 index 0000000..59e102b --- /dev/null +++ b/modules/bar/components/bluetooth/BluetoothMenu.qml @@ -0,0 +1,30 @@ +import qs.config +import qs.styled +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell.Bluetooth + +StyledPopupWindow { + id: root + + backgroundColor: Theme.palette.base300 + margins: 8 + radius: 8 + + property BluetoothAdapter defaultAdapter: Bluetooth.defaultAdapter + + content: ColumnLayout { + + RowLayout { + StyledText { + text: root.defaultAdapter.name + } + + Switch { + checked: root.defaultAdapter.enabled + onClicked: root.defaultAdapter.enabled = checked + } + } + } +}