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
12 changes: 11 additions & 1 deletion systray.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (
)

var (
log = golog.LoggerFor("systray")
// ClickedCh is the channel which will be notified when the systray icon is clicked
ClickedCh = make(chan struct{})
log = golog.LoggerFor("systray")

systrayReady func()
systrayExit func()
Expand Down Expand Up @@ -208,3 +210,11 @@ func systrayMenuItemSelected(id int32) {
default:
}
}

func systrayClicked() {
select {
case ClickedCh <- struct{}{}:
default:
showMenu()
}
}
3 changes: 3 additions & 0 deletions systray_nonwindows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func nativeLoop() {
C.nativeLoop()
}

func showMenu() {
}

func quit() {
C.quit()
}
Expand Down
8 changes: 7 additions & 1 deletion systray_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@ func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam ui
systrayExit()
case t.wmSystrayMessage:
switch lParam {
case WM_RBUTTONUP, WM_LBUTTONUP:
case WM_RBUTTONUP:
t.showMenu()
case WM_LBUTTONUP:
systrayClicked()
}
case t.wmTaskbarCreated: // on explorer.exe restarts
t.muNID.Lock()
Expand Down Expand Up @@ -803,6 +805,10 @@ func nativeLoop() {
}
}

func showMenu() {
wt.showMenu()
}

func quit() {
const WM_CLOSE = 0x0010

Expand Down