quickshell: fix tray popup anchor and menu display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 10:26:56 +01:00
parent 9dc4067a59
commit 88c2b7b107

View file

@ -656,18 +656,17 @@ in
PopupWindow { PopupWindow {
id: trayPopup id: trayPopup
anchor.window: bar anchor.item: trayToggle
anchor.adjustment: PopupAdjustment.None anchor.edges: Edges.Bottom | Edges.Right
anchor.gravity: Edges.Bottom | Edges.Left
anchor.adjustment: PopupAdjustment.Slide
visible: false visible: false
color: "transparent" color: "transparent"
implicitWidth: trayContent.width + 2 implicitWidth: trayRow.width + 24
implicitHeight: trayContent.height + 2 implicitHeight: 36
Rectangle { Rectangle {
id: trayContent anchors.fill: parent
anchors.centerIn: parent
width: trayRow.width + 24
height: 36
color: "#${c.base00}" color: "#${c.base00}"
border.color: "#${c.base03}" border.color: "#${c.base03}"
border.width: 1 border.width: 1
@ -681,21 +680,28 @@ in
Repeater { Repeater {
model: SystemTray.items model: SystemTray.items
Image { Item {
required property var modelData required property var modelData
Layout.preferredWidth: 20
Layout.preferredHeight: 20
Image {
anchors.fill: parent
source: modelData.icon source: modelData.icon
Layout.preferredWidth: 18 sourceSize.width: 20
Layout.preferredHeight: 18 sourceSize.height: 20
smooth: true smooth: true
mipmap: true
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (event) => { onClicked: (event) => {
if (event.button === Qt.RightButton && parent.modelData.hasMenu) { if (event.button === Qt.RightButton && modelData.hasMenu) {
parent.modelData.display(trayPopup, mouse.x, mouse.y); modelData.display(bar, event.x, event.y);
} else { } else {
parent.modelData.activate(); modelData.activate();
} }
} }
} }