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