diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c index d18baacc..7e416db8 100644 --- a/src/fe-gtk/gtkutil.c +++ b/src/fe-gtk/gtkutil.c @@ -1120,7 +1120,9 @@ gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...) gboolean gtkutil_tray_icon_supported (GtkWindow *window) { -#ifdef GDK_WINDOWING_X11 +#if defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_APPINDICATOR) + return TRUE; +#elif defined(GDK_WINDOWING_X11) GdkScreen *screen = gtk_window_get_screen (window); GdkDisplay *display = gdk_screen_get_display (screen); if (!GDK_IS_X11_DISPLAY (display)) 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 */