Problem
When running the following PyQt5 code on MacOS (Sierra 10.12.6)
self.tray_icon = QtWidgets.QSystemTrayIcon(QtGui.QIcon("icon/path"), self)
self.tray_icon.activated.connect(self.on_systray_activated)
[...]
def on_systray_activated(self, i_reason):
logging.debug("entered on_systray_activated. i_reason = " + str(i_reason))
we get the activation reason QSystemTrayIcon::Trigger
even when right clicking
On other systems (for example XFCE) we get QSystemTrayIcon::Context
when the user right clicks
Question
How can we distinguish between left and right click on the systray icon on MacOS?
The QApplication.mouseButtons method can be used to get the current state of the mouse buttons: