aboutsummaryrefslogtreecommitdiff
path: root/modules/system/quickshell/AnchoredPopup.qml
diff options
context:
space:
mode:
authorLeander Scherer <leander@schererleander.de>2026-05-30 15:35:27 +0200
committerLeander Scherer <leander@schererleander.de>2026-05-30 15:35:27 +0200
commitd2747e2ca1e211a32e91e44010f40a00e0ac97e4 (patch)
treefb229d6a18541c7a5f1944390b21edde028955f9 /modules/system/quickshell/AnchoredPopup.qml
parent51b3cbd50b92d026549ce3ebff17ca9b3344f441 (diff)
feat(quickshell): add popup controls and privacy indicators
Diffstat (limited to 'modules/system/quickshell/AnchoredPopup.qml')
-rw-r--r--modules/system/quickshell/AnchoredPopup.qml77
1 files changed, 77 insertions, 0 deletions
diff --git a/modules/system/quickshell/AnchoredPopup.qml b/modules/system/quickshell/AnchoredPopup.qml
new file mode 100644
index 0000000..76d4ccd
--- /dev/null
+++ b/modules/system/quickshell/AnchoredPopup.qml
@@ -0,0 +1,77 @@
+import QtQuick
+import Quickshell
+import Quickshell.Wayland
+
+Scope {
+ id: root
+
+ property string popupName: ""
+ property var anchorWindow
+ property var anchorItem
+ property int popupGap: Theme.popupGap
+ readonly property bool open: GlobalState.activePopup === popupName
+ default property alias content: contentRoot.data
+
+ signal opened
+ signal closed
+
+ PanelWindow {
+ visible: root.open
+ anchors {
+ top: true
+ bottom: true
+ left: true
+ right: true
+ }
+ WlrLayershell.layer: WlrLayer.Top
+ WlrLayershell.margins.top: Theme.barHeight
+ WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
+ exclusionMode: ExclusionMode.Ignore
+ color: Theme.transparent
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.AllButtons
+ hoverEnabled: true
+ onClicked: GlobalState.close()
+ onWheel: wheel => wheel.accepted = true
+ }
+ }
+
+ PopupWindow {
+ id: popup
+ visible: root.open
+ grabFocus: true
+ implicitWidth: contentRoot.childrenRect.width
+ implicitHeight: contentRoot.childrenRect.height
+
+ anchor {
+ window: root.anchorWindow
+ item: root.anchorItem
+ edges: Edges.Bottom
+ gravity: Edges.Bottom
+ margins.top: root.popupGap
+ }
+
+ color: Theme.transparent
+
+ onVisibleChanged: {
+ if (visible) {
+ anchor.updateAnchor();
+ contentRoot.forceActiveFocus();
+ root.opened();
+ } else {
+ root.closed();
+ }
+ }
+
+ Item {
+ id: contentRoot
+ focus: true
+ width: childrenRect.width
+ height: childrenRect.height
+
+ Keys.onEscapePressed: GlobalState.close()
+ }
+ }
+}