Skip to content

Commit 3e53d06

Browse files
committed
Widen API to show svg icons
1 parent 4ec1101 commit 3e53d06

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,41 @@ static Optional<TrayMenuController> get() {
2828
* @param tooltip Text shown when hovering
2929
* @throws TrayMenuException thrown when adding the tray icon failed
3030
*/
31-
void showTrayIcon(byte[] imageData, Runnable defaultAction, String tooltip) throws TrayMenuException;
31+
default void showTrayIcon(byte[] imageData, Runnable defaultAction, String tooltip) throws TrayMenuException {
32+
showTrayIcon(imageData, null, defaultAction, tooltip);
33+
};
34+
35+
/**
36+
* Displays an icon on the system tray.
37+
*
38+
* @param imageData What image to show
39+
* @param icon The icon name of the icon to show. Can be an icon name following
40+
* the Freedesktop Icon Naming Specification or a path to an icon file
41+
* @param defaultAction Action to perform when interacting with the icon directly instead of its menu
42+
* @param tooltip Text shown when hovering
43+
* @throws TrayMenuException thrown when adding the tray icon failed
44+
*/
45+
void showTrayIcon(byte[] imageData, String icon, Runnable defaultAction, String tooltip) throws TrayMenuException;
46+
47+
/**
48+
* Updates the icon on the system tray.
49+
*
50+
* @param imageData What image to show
51+
* @throws IllegalStateException thrown when called before an icon has been added
52+
*/
53+
default void updateTrayIcon(byte[] imageData) {
54+
updateTrayIcon(imageData, null);
55+
};
3256

3357
/**
3458
* Updates the icon on the system tray.
3559
*
3660
* @param imageData What image to show
61+
* @param icon The icon name of the icon to show. Can be an icon name following
62+
* the Freedesktop Icon Naming Specification or a path to an icon file
3763
* @throws IllegalStateException thrown when called before an icon has been added
3864
*/
39-
void updateTrayIcon(byte[] imageData);
65+
void updateTrayIcon(byte[] imageData, String icon);
4066

4167
/**
4268
* Show the given options in the tray menu.

0 commit comments

Comments
 (0)