pystray: Is there any way to add a double click in the tray icon?

79 Views Asked by At

pynput.mouse.Listener only listens for mouse events but it has no option for any kind of events outside of just listening, Like knowing what the mouse actually clicked on. I've played around with the kwargs for win32_ but I don't understand it. I want to add a double click event to the tray icon.

def start():
    global ICON

    ICON = Icon(
        name = 'Monitor Power Utility',
        title = 'Monitor Power Utility',
        icon = Image.open(r'C:\Users\phpjunkie\Documents\IconFiles\MonitorPowerUtility.ico'),
        menu = Menu(
            MenuItem(
                text = 'Monitor Power Utility',
                enabled = False,
                action = None
            ),
            Menu.SEPARATOR,
            MenuItem(
                text = 'Power Off Monitors',
                action = lambda: start_process(),
                default = True
            ),
            Menu.SEPARATOR,
            MenuItem(
                text = 'Exit',
                action = lambda: close()
            )
        )
    )
    ICON.run()
0

There are 0 best solutions below