Detect the difference between left/right clicks on the MenuBarExtra item #2
Replies: 1 comment 11 replies
-
MenuBarExtra is managing that and only connects left (primary) click. From my experience thus far, it may be possible by accessing the NSStatusItem and manipulating it. But there was a reason I didn’t outwardly expose the NSStatusItem in this library. MenuBarExtra operates under the assumption that it owns and manages the status item. Which means we can’t anticipate what Apple may do in future iterations of SwiftUI. So a hacky solution that works now could break or crash in the future. It’s a balancing act. Apple needs to add 1st-party support for these features ideally (including presentation binding, left/right mouse differentiation, etc.). So submitting radars for feature requests to Apple and having patience may produce some results eventually. This library is just meant to act as a bridge to coax more functionality out of MenuBarExtra because, ever the optimist, I want to adopt new technologies and show my support for them. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Thanks for your awesome work! I have a question which may be out of scope of this project, but because in-depth information related to MenuBarExtra is still hard to find, I'm giving it a shot :)
Would it be possible to detect the difference between left and right clicks on the MenuBarExtra item? I have used this in the past in applications that used NSStatusBar with a statusItem, see here for some background information on how to get that to work: https://stackoverflow.com/questions/59635971/show-nsmenu-only-on-nsstatusbarbutton-right-click
I was hoping that this could also be done with MenuBarExtra natively-ish, without having to fallback on the AppDelegate/NSStatusBar approach. What's your take on this? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions