Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/pystray/_util/win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
WM_CREATE = 0x0001
WM_NCCREATE = 0x0081
WM_LBUTTONUP = 0x0202
WM_LBUTTONDBLCLK = 0x0203
WM_RBUTTONUP = 0x0205
WM_USER = 0x400

Expand Down
9 changes: 7 additions & 2 deletions lib/pystray/_win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def __init__(self, *args, **kwargs):
self._menu_hwnd = None
self._hmenu = None

self._default_double_click = self._options.get('default_double_click', False)

# This is a mapping from win32 event codes to handlers used by the
# mainloop
self._message_handlers = {
Expand Down Expand Up @@ -187,8 +189,11 @@ def _on_notify(self, wparam, lparam):
displayed.
"""
if lparam == win32.WM_LBUTTONUP:
self()

if not self._default_double_click:
self()
elif lparam == win32.WM_LBUTTONDBLCLK:
if self._default_double_click:
self()
elif self._menu_handle and lparam == win32.WM_RBUTTONUP:
# TrackPopupMenuEx does not behave unless our systray window is the
# foreground window
Expand Down