quickshell: fix tray icon click handling (left/right click, onlyMenu)
Left click → activate (or open menu if onlyMenu is set) Right click → open context menu (or secondaryActivate if no menu) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
35c0e2dc2a
commit
c376f0d266
1 changed files with 21 additions and 8 deletions
|
|
@ -1177,15 +1177,28 @@ in
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: (event) => {
|
onClicked: (event) => {
|
||||||
if (modelData.hasMenu) {
|
if (event.button === Qt.RightButton) {
|
||||||
bar.toggleDropdown(contextMenu, function() {
|
if (modelData.hasMenu) {
|
||||||
let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0);
|
bar.toggleDropdown(contextMenu, function() {
|
||||||
contextMenu.dropdownX = pos.x;
|
let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0);
|
||||||
contextMenu.trayItem = modelData;
|
contextMenu.dropdownX = pos.x;
|
||||||
menuOpener.menu = modelData.menu;
|
contextMenu.trayItem = modelData;
|
||||||
});
|
menuOpener.menu = modelData.menu;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
modelData.secondaryActivate();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
modelData.activate();
|
if (modelData.onlyMenu && modelData.hasMenu) {
|
||||||
|
bar.toggleDropdown(contextMenu, function() {
|
||||||
|
let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0);
|
||||||
|
contextMenu.dropdownX = pos.x;
|
||||||
|
contextMenu.trayItem = modelData;
|
||||||
|
menuOpener.menu = modelData.menu;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
modelData.activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue