I used Wayland to start gnome-shell. I wrote a test applet. The main function of this test program is to display icons in the tray, but it has no effect. There is nothing in the tray.
There is no problem with xorg. What should I do and what method should I use to display icons in the tray
This is my test code
#include <libappindicator/app-indicator.h>
static GtkActionEntry entries[] = {
{ "Quit", "application-exit", "_Quit", "<control>Q",
"Exit the application", G_CALLBACK (gtk_main_quit) },
};
static guint n_entries = G_N_ELEMENTS (entries);
static const gchar *ui_info =
"<ui>"
" <popup name='IndicatorPopup'>"
" <menuitem action='Quit' />"
" </popup>"
"</ui>";
int main (int argc, char **argv)
{
GtkWidget *indicator_menu;
GtkActionGroup *action_group;
GtkUIManager *uim;
GError *error = NULL;
AppIndicator *indicator;
gtk_init (&argc, &argv);
indicator = app_indicator_new ("simple-clock-indicator",
"emblem-synchronizing",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
/* Menus */
action_group = gtk_action_group_new ("SimpleActions");
gtk_action_group_add_actions (action_group,
entries, n_entries,
indicator);
uim = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (uim, action_group, 0);
if (!gtk_ui_manager_add_ui_from_string (uim, ui_info, -1, &error)) {
g_message ("Failed to build menus: %s\n", error->message);
g_error_free (error);
error = NULL;
}
app_indicator_set_status (indicator, APP_INDICATOR_STATUS_ACTIVE);
app_indicator_set_title (indicator, "SimpleClockTitle");
indicator_menu = gtk_ui_manager_get_widget (uim, "/ui/IndicatorPopup");
app_indicator_set_menu (indicator, GTK_MENU (indicator_menu));
gtk_main ();
return 0;
}