From 416b8449b9e45e32d6c31eb178b92780cdfc313c Mon Sep 17 00:00:00 2001 From: deepend-tildeclub Date: Fri, 20 Mar 2026 23:18:19 -0600 Subject: [PATCH] Fix AppIndicator tray init for Wayland/source builds --- src/fe-gtk/meson.build | 4 ++-- src/fe-gtk/plugin-tray.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/fe-gtk/meson.build b/src/fe-gtk/meson.build index 561016ae..06b71ce0 100644 --- a/src/fe-gtk/meson.build +++ b/src/fe-gtk/meson.build @@ -65,8 +65,8 @@ if host_machine.system() != 'windows' if appindicator_dep.found() zoitechat_gtk_deps += appindicator_dep zoitechat_gtk_cflags += '-DHAVE_APPINDICATOR' - elif appindicator_opt.enabled() - error('appindicator=enabled, but neither ayatana-appindicator3-0.1 nor appindicator3-0.1 was found') + elif appindicator_opt.enabled() or (appindicator_opt.auto() and host_machine.system() == 'linux') + error('tray support requires ayatana-appindicator3-0.1 or appindicator3-0.1 on Linux (use -Dappindicator=disabled to override)') endif endif endif diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index dbc0653d..2ba4bae8 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -364,8 +364,8 @@ tray_app_indicator_set_icon (TrayIcon icon) if (!icon_name) return; - app_indicator_set_icon_full (tray_indicator, icon_name, _(DISPLAY_NAME)); app_indicator_set_status (tray_indicator, APP_INDICATOR_STATUS_ACTIVE); + app_indicator_set_icon_full (tray_indicator, icon_name, _(DISPLAY_NAME)); g_free (icon_name_alloc); } @@ -431,7 +431,6 @@ tray_app_indicator_init (void) g_signal_connect (G_OBJECT (tray_menu), "map", G_CALLBACK (tray_menu_show_cb), NULL); app_indicator_set_menu (tray_indicator, GTK_MENU (tray_menu)); - app_indicator_set_status (tray_indicator, APP_INDICATOR_STATUS_ACTIVE); klass = G_OBJECT_GET_CLASS (tray_indicator); if (klass && g_object_class_find_property (klass, "connected")) @@ -1390,9 +1389,14 @@ tray_apply_setup (void) } else { +#if HAVE_APPINDICATOR_BACKEND + if (prefs.hex_gui_tray) + tray_init (); +#else GtkWindow *window = GTK_WINDOW(zoitechat_get_info (ph, "gtkwin_ptr")); if (prefs.hex_gui_tray && gtkutil_tray_icon_supported (window)) tray_init (); +#endif } } @@ -1439,7 +1443,11 @@ tray_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, G_CALLBACK (tray_window_visibility_cb), NULL); } +#if HAVE_APPINDICATOR_BACKEND + if (prefs.hex_gui_tray) +#else if (prefs.hex_gui_tray && gtkutil_tray_icon_supported (window)) +#endif tray_init (); return 1; /* return 1 for success */