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

[macOS] Allow setting status item interactive removal behavior #262

Closed clintharrison closed 11 months ago

clintharrison commented 11 months ago

The macOS menu bar can be pretty small on laptops with a screen notch. This PR adds a small macOS-only function to enable some optional behavior, NSStatusItemBehaviorRemovalAllowed, which allows removing an icon with cmd-drag.

It seems though this is stored in the application preferences, and so once hidden, an application can't come back! To work around that and keep a very simple API, applications using systray will always return to the menu bar on startup. This seemed like an okay compromise.

clintharrison commented 11 months ago

@Crosse, @anacrolix, are you able to take a look at this PR? Thanks!

anacrolix commented 11 months ago

image