From ab2868ef7c8770e9401b50b2f0b6dbd793c47bec Mon Sep 17 00:00:00 2001 From: Edward Chow Date: Mon, 7 Nov 2022 04:20:55 +1100 Subject: [PATCH] add `onBeforeOpenMenu` listener to TrayMenuController (#11) --- .../integrations/tray/TrayMenuController.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java b/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java index 2d8b864..63edf14 100644 --- a/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java +++ b/src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java @@ -40,4 +40,16 @@ static Optional get() { */ void updateTrayMenu(List items) throws TrayMenuException; + /** + * Action to run before the tray menu opens. + *

+ * This method is used to set up an event listener for when the menu is opened, + * e.g. so that the vault list can be updated to reflect volume mount state changes + * which occur while Cryptomator is in the system tray (and not open). + * + * @param listener + * @throws IllegalStateException thrown when adding listeners fails (i.e. there's no tray menu) + */ + void onBeforeOpenMenu(Runnable listener); + }