diff --git a/applets/systemtray/package/contents/ui/items/AbstractItem.qml b/applets/systemtray/package/contents/ui/items/AbstractItem.qml --- a/applets/systemtray/package/contents/ui/items/AbstractItem.qml +++ b/applets/systemtray/package/contents/ui/items/AbstractItem.qml @@ -41,6 +41,7 @@ signal clicked(var mouse) signal wheel(var wheel) + signal contextMenu(var mouse) property bool forcedHidden: plasmoid.configuration.hiddenItems.indexOf(itemId) !== -1 property bool forcedShown: plasmoid.configuration.showAllItems || plasmoid.configuration.shownItems.indexOf(itemId) !== -1 @@ -99,8 +100,15 @@ drag.filterChildren: true acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton onClicked: { + if (mouse.button !== Qt.RightButton) { + abstractItem.clicked(mouse) + } + } + onPressed: { abstractItem.hideToolTip() - abstractItem.clicked(mouse) + if (mouse.button === Qt.RightButton) { + abstractItem.contextMenu(mouse) + } } onWheel: { abstractItem.wheel(wheel); diff --git a/applets/systemtray/package/contents/ui/items/PlasmoidItem.qml b/applets/systemtray/package/contents/ui/items/PlasmoidItem.qml --- a/applets/systemtray/package/contents/ui/items/PlasmoidItem.qml +++ b/applets/systemtray/package/contents/ui/items/PlasmoidItem.qml @@ -39,14 +39,16 @@ active: root.activeApplet != applet onClicked: { + if (applet && mouse.button == Qt.LeftButton) { + applet.expanded = true; + } + } + onContextMenu: { if (applet) { - if (mouse.button == Qt.LeftButton) { - applet.expanded = true; - } else if (mouse.button == Qt.RightButton) { - plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.hidden ? applet.height : 0); - } + plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.hidden ? applet.height : 0); } } + onHeightChanged: { if (applet) { applet.width = height diff --git a/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml b/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml --- a/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml +++ b/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml @@ -71,31 +71,31 @@ service.startOperationCall(operation); break; } - case Qt.RightButton: { - var service = statusNotifierSource.serviceForSource(DataEngineSource); - var operation = service.operationDescription("ContextMenu"); - operation.x = pos.x; - operation.y = pos.y; - - var job = service.startOperationCall(operation); - job.finished.connect(function () { - plasmoid.nativeInterface.showStatusNotifierContextMenu(job, taskIcon); - }); - - break; - } case Qt.MiddleButton: var service = statusNotifierSource.serviceForSource(DataEngineSource); var operation = service.operationDescription("SecondaryActivate"); operation.x = pos.x; operation.y = pos.y; service.startOperationCall(operation); break; - break; } } + onContextMenu: { + var pos = plasmoid.nativeInterface.popupPosition(taskIcon, 0, 0); + + var service = statusNotifierSource.serviceForSource(DataEngineSource); + var operation = service.operationDescription("ContextMenu"); + operation.x = pos.x; + operation.y = pos.y; + + var job = service.startOperationCall(operation); + job.finished.connect(function () { + plasmoid.nativeInterface.showStatusNotifierContextMenu(job, taskIcon); + }); + } + onWheel: { //don't send activateVertScroll with a delta of 0, some clients seem to break (kmix) if (wheel.angleDelta.y !== 0) {