1
1
package org .cryptomator .linux .tray ;
2
2
3
+ import org .apache .commons .lang3 .StringUtils ;
3
4
import org .cryptomator .integrations .common .CheckAvailability ;
4
5
import org .cryptomator .integrations .common .OperatingSystem ;
5
6
import org .cryptomator .integrations .common .Priority ;
22
23
import static org .purejava .appindicator .app_indicator_h .*;
23
24
24
25
@ Priority (1000 )
26
+ @ CheckAvailability
25
27
@ OperatingSystem (OperatingSystem .Value .LINUX )
26
28
public class AppindicatorTrayMenuController implements TrayMenuController {
27
-
28
29
private static final String APP_INDICATOR_ID = "org.cryptomator.Cryptomator" ;
29
30
30
31
private static final SegmentScope SCOPE = SegmentScope .global ();
@@ -46,9 +47,18 @@ public void showTrayIcon(Consumer<TrayIconLoader> iconLoader, Runnable runnable,
46
47
47
48
private void showTrayIconWithSVG (String s ) {
48
49
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 ),
50
58
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" ));
52
62
}
53
63
}
54
64
0 commit comments