11package org .cryptomator .linux .tray ;
22
3+ import org .apache .commons .lang3 .StringUtils ;
34import org .cryptomator .integrations .common .CheckAvailability ;
45import org .cryptomator .integrations .common .OperatingSystem ;
56import org .cryptomator .integrations .common .Priority ;
2223import static org .purejava .appindicator .app_indicator_h .*;
2324
2425@ Priority (1000 )
26+ @ CheckAvailability
2527@ OperatingSystem (OperatingSystem .Value .LINUX )
2628public class AppindicatorTrayMenuController implements TrayMenuController {
27-
2829 private static final String APP_INDICATOR_ID = "org.cryptomator.Cryptomator" ;
2930
3031 private static final SegmentScope SCOPE = SegmentScope .global ();
@@ -46,9 +47,18 @@ public void showTrayIcon(Consumer<TrayIconLoader> iconLoader, Runnable runnable,
4647
4748 private void showTrayIconWithSVG (String s ) {
4849 try (var arena = Arena .openConfined ()) {
49- indicator = app_indicator_new (arena .allocateUtf8String (APP_INDICATOR_ID ),
50+ var appdir = System .getenv ("APPDIR" );
51+ if (null == appdir || appdir .isBlank ()) {
52+ appdir = "" ;
53+ }
54+ if (appdir .endsWith ("/" )) {
55+ appdir = StringUtils .chop (appdir );
56+ }
57+ indicator = app_indicator_new_with_path (arena .allocateUtf8String (APP_INDICATOR_ID ),
5058 arena .allocateUtf8String (s ),
51- APP_INDICATOR_CATEGORY_APPLICATION_STATUS ());
59+ APP_INDICATOR_CATEGORY_APPLICATION_STATUS (),
60+ // find tray icons theme in mounted AppImage
61+ arena .allocateUtf8String (appdir + "/usr/share/icons/hicolor/symbolic/apps" ));
5262 }
5363 }
5464
0 commit comments