getlantern / systray

a cross platfrom Go library to place an icon and menu in the notification area
Apache License 2.0
3.28k stars 451 forks source link

How do we make a dock icon do something interesting when clicked? #239

Closed OptimisticLock closed 2 years ago

OptimisticLock commented 2 years ago

There is a large app icon sitting in the dock on Mac. We could remove it, but we'd prefer it to do something interesting, e.g. open a popup or a window. Any way to do that?

Crosse commented 2 years ago

This library is for adding an icon to the system tray (the menu bar, on macOS); it doesn't do anything fancy with dock icons. You'll need to handle that in your app's code, I think.

OptimisticLock commented 2 years ago

Would it be possible to have the dock icon behave identically to the system tray icon? Seems like an easy enough change. I just can't imagine a purpose for it otherwise.

Crosse commented 2 years ago

Perhaps, but I don't think that is the purpose of this library. That said, I may be misunderstanding your intent, here. When you build an app, you'll have a Dock item for the running app, and—when using this library—a system tray icon. Looking at my desktop right now, I see that some apps have both a system tray icon and a Dock icon, but some only have the system tray icon because they've hidden their Dock icon. This library takes care of the systray icon and its functionality, but doing anything with the app's Dock icon is up to your code.