Skip to content

Commit

Permalink
Sui(fix): some trayicon/appindicator fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Dec 13, 2023
1 parent 6cfdccf commit a732f78
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/sui/sui_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ void sui_application_send_notification(SuiApplication *self,
}

void sui_application_highlight_tray_icon(SuiApplication *self, bool highlight){
#ifndef ENABLE_APP_INDICATOR
#ifdef ENABLE_APP_INDICATOR
app_indicator_set_status(self->tray_icon,
highlight ? APP_INDICATOR_STATUS_ATTENTION : APP_INDICATOR_STATUS_ACTIVE);
#else
gtk_status_icon_set_from_icon_name(self->tray_icon,
highlight ? "srain-red": PACKAGE);
#endif
Expand Down Expand Up @@ -478,11 +481,14 @@ static void on_startup(SuiApplication *self){
self->tray_icon = app_indicator_new(PACKAGE_APPID, PACKAGE_APPID,
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
app_indicator_set_status(self->tray_icon, APP_INDICATOR_STATUS_ACTIVE);
app_indicator_set_attention_icon(self->tray_icon, "srain-red");
app_indicator_set_attention_icon_full(self->tray_icon, "srain-red", "srain-red");
app_indicator_set_menu(self->tray_icon, self->menu);
app_indicator_set_title(self->tray_icon, PACKAGE);
#else
self->tray_icon = gtk_status_icon_new_from_icon_name(PACKAGE_APPID);
g_signal_connect(self->tray_icon, "activate", G_CALLBACK(tray_icon_on_click), self);
g_signal_connect(self->tray_icon, "popup-menu", G_CALLBACK(tray_icon_on_popup_menu), self);
gtk_status_icon_set_tooltip_text(self->tray_icon, PACKAGE);
#endif

// Attach to any widget to connect to action
Expand Down

0 comments on commit a732f78

Please sign in to comment.