You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MacOS - Tray Vault Item is Clickable with no Action #1977
The Vault menu item in the tray (with dropdown) is clickable and performs no action except close the tray.
What software is involved?
Operating System: MacOS (11.6)
Cryptomator: 1.6.4
Volume Type
No response
Steps to Reproduce
Install on Mac
Create a vault
Click on Cryptomator menu bar item
Click on your Vault menu item (the item highlighted)
Expected Behavior
Nothing should happen.
A menu item with dropdown/submenu is not usually clickable (it shows the submenu on hover with no click action).
Actual Behavior
The vault menu item is clickable and closes the menu dialog without performing any action.
It can be annoying when you click on you vault menu item and the tray closes without doing any action. (i.e. Accidentally clicked, or intentionally clicked expecting to open the submenu, or intentionally clicked expecting it to unlock the vault)
Reproducibility
Always
Relevant Log Output
No response
Anything else?
I assume that some sort of parameter would need to change in this part of the code in order to make the vault menu item non-clickable.
FYI I had a first look at the code base from Cryptomator. I think the problem lies in the SubMenu class because it offers no Runnable like the ActionItem does. In the SubMenu case block should sth. be like this: submenu.addActionListener(evt -> s.action().run());.
Worth a try, but I kind of believe that the item in question being clickable will not improve by adding an action listener. Probably this is just the way, AWT menus (mis)behave on macOS.
FYI I had a first look at the code base from Cryptomator. I think the problem lies in the SubMenu class because it offers no Runnable like the ActionItem does. In the SubMenu case block should sth. be like this: submenu.addActionListener(evt -> s.action().run());.
I am really not sure what I was talking back then. The AWT Menu class and the PopupMenu are the only Menu classes that are implementing the MenuItem. They behave all in that way. I even tried to add an action listener that disables the menu with the method setEnabled. The action is only called when it is clicked. If it's initially set to disable, it's not clickable at any time (and not hoverable and no items are shown). I think you @overheadhunter are right.
Worth a try, but I kind of believe that the item in question being clickable will not improve by adding an action listener.
Probably this is just the way, AWT menus (mis)behave on macOS.
I would say the bug somewhat lies in src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.java but not really 😅
Vault items are rendered as java.awt.Menu objects.
MacOS AWT just defines that the tray is dismissed when the submenu item is clicked. This is no bug but this just isn't what we want.
The only option I see to make it behave as want is by setting an NSMenuDelegate on the underlying NSMenu and returning NO from menu:shouldSelectItem: for items that have a submenu. This prevents click-to-dismiss while still allowing hover-to-expand.
The problem is getting access to that NSMenu. AWT's internal peer APIs that expose the native pointer were removed in Java 9, so we cannot retrieve the NSMenu from an existing java.awt.PopupMenu. This means we cannot simply patch AwtTrayMenuController.
The only approach I can imagine that works cleanly is implementing a full MacTrayMenuController in integrations-mac that manages the NSStatusItem and NSMenu natively via AppKit, bypassing AWT entirely. This is roughly 250 lines of Objective-C and reimplements everything AWT was doing for free (tray icon, image loading, menu building, Java callbacks via JNI).
I'm hesitant to submit this as it is a large, fragile surface area change for what is conceptually a one-line behavioral fix.
Before going further, I wanted to ask: is there an approach I'm missing, or is a full native TrayMenuController implementation the intended path for this fix?
is there an approach I'm missing, or is a full native TrayMenuController implementation the intended path for this fix?
This is in fact what the "integrations-api" is about: Providing alternative implementations for OS-specific integrations. If there is no other way, use native means.
If you think you can fix this, go ahead. We can still keep the AWT implementation as a fallback and simply steer which implementation to use via a priority annotation.
Activity
radon-86 commentedon Jul 5, 2023
FYI I had a first look at the code base from Cryptomator. I think the problem lies in the SubMenu class because it offers no Runnable like the ActionItem does. In the SubMenu case block should sth. be like this:
submenu.addActionListener(evt -> s.action().run());.overheadhunter commentedon Jul 7, 2023
Worth a try, but I kind of believe that the item in question being clickable will not improve by adding an action listener. Probably this is just the way, AWT menus (mis)behave on macOS.
radon-86 commentedon Aug 2, 2024
I am really not sure what I was talking back then. The AWT Menu class and the PopupMenu are the only Menu classes that are implementing the MenuItem. They behave all in that way. I even tried to add an action listener that disables the menu with the method setEnabled. The action is only called when it is clicked. If it's initially set to disable, it's not clickable at any time (and not hoverable and no items are shown). I think you @overheadhunter are right.
oc7o commentedon May 17, 2026
I would say the bug somewhat lies in
src/main/java/org/cryptomator/ui/traymenu/AwtTrayMenuController.javabut not really 😅Vault items are rendered as
java.awt.Menuobjects.MacOS AWT just defines that the tray is dismissed when the submenu item is clicked. This is no bug but this just isn't what we want.
The only option I see to make it behave as want is by setting an
NSMenuDelegateon the underlyingNSMenuand returningNOfrommenu:shouldSelectItem:for items that have a submenu. This prevents click-to-dismiss while still allowing hover-to-expand.The problem is getting access to that
NSMenu. AWT's internal peer APIs that expose the native pointer were removed in Java 9, so we cannot retrieve the NSMenu from an existingjava.awt.PopupMenu. This means we cannot simply patchAwtTrayMenuController.The only approach I can imagine that works cleanly is implementing a full
MacTrayMenuControllerin integrations-mac that manages theNSStatusItemandNSMenunatively via AppKit, bypassing AWT entirely. This is roughly 250 lines of Objective-C and reimplements everything AWT was doing for free (tray icon, image loading, menu building, Java callbacks via JNI).I'm hesitant to submit this as it is a large, fragile surface area change for what is conceptually a one-line behavioral fix.
Before going further, I wanted to ask: is there an approach I'm missing, or is a full native
TrayMenuControllerimplementation the intended path for this fix?overheadhunter commentedon May 19, 2026
@oc7o
This is in fact what the "integrations-api" is about: Providing alternative implementations for OS-specific integrations. If there is no other way, use native means.
If you think you can fix this, go ahead. We can still keep the AWT implementation as a fallback and simply steer which implementation to use via a priority annotation.
Thanks for taking the initiative!
oc7o commentedon May 24, 2026
@overheadhunter thx for the reply.
I finally found the time to push my proposal into this PR: cryptomator/integrations-mac#120
Update integrations-mac to version 1.7.0