1212import org .cryptomator .integrations .tray .TrayMenuItem ;
1313import org .purejava .appindicator .GCallback ;
1414import org .purejava .appindicator .MemoryAllocator ;
15- import org .slf4j .Logger ;
16- import org .slf4j .LoggerFactory ;
1715
1816import java .lang .foreign .Arena ;
1917import java .lang .foreign .MemorySegment ;
2725@ OperatingSystem (OperatingSystem .Value .LINUX )
2826public class AppindicatorTrayMenuController implements TrayMenuController {
2927
30- private static final Logger LOG = LoggerFactory . getLogger ( AppindicatorTrayMenuController . class ) ;
28+ private static final String APP_INDICATOR_ID = "org.cryptomator.Cryptomator" ;
3129
3230 private static final SegmentScope SCOPE = SegmentScope .global ();
3331 private MemorySegment indicator ;
@@ -43,13 +41,12 @@ public void showTrayIcon(Consumer<TrayIconLoader> iconLoader, Runnable runnable,
4341 TrayIconLoader .FreedesktopIconName callback = this ::showTrayIconWithSVG ;
4442 iconLoader .accept (callback );
4543 gtk_widget_show_all (menu );
46- app_indicator_set_menu (indicator , menu );
4744 app_indicator_set_status (indicator , APP_INDICATOR_STATUS_ACTIVE ());
4845 }
4946
5047 private void showTrayIconWithSVG (String s ) {
5148 try (var arena = Arena .openConfined ()) {
52- indicator = app_indicator_new (arena .allocateUtf8String ("org.cryptomator.Cryptomator" ),
49+ indicator = app_indicator_new (arena .allocateUtf8String (APP_INDICATOR_ID ),
5350 arena .allocateUtf8String (s ),
5451 APP_INDICATOR_CATEGORY_APPLICATION_STATUS ());
5552 }
@@ -110,7 +107,6 @@ private void addChildren(MemorySegment menu, List<TrayMenuItem> items) {
110107 gtk_menu_shell_append (menu , gtkMenuItem );
111108 }
112109 }
113- gtk_widget_show_all (menu );
114110 }
115111 }
116112}
0 commit comments