Merge pull request #70 from ZoiteChat/fixtrayicon

Investigated the XFCE tray issue and confirmed the code path depe…
This commit is contained in:
deepend-tildeclub
2026-02-22 16:21:39 +00:00
committed by GitHub
5 changed files with 35 additions and 8 deletions

View File

@@ -47,7 +47,8 @@ jobs:
-Dtext-frontend=true \
-Dwith-perl=perl \
-Dwith-python=python3 \
-Dauto_features=enabled
-Dauto_features=enabled \
-Dappindicator=enabled
- name: Build
run: |

View File

@@ -8,6 +8,7 @@
"finish-args": [
"--share=ipc",
"--socket=wayland",
"--socket=fallback-x11",
"--share=network",
"--socket=pulseaudio",
"--filesystem=xdg-download",
@@ -15,8 +16,11 @@
"--filesystem=xdg-data/icons:ro",
"--filesystem=~/.themes:ro",
"--filesystem=~/.icons:ro",
"--filesystem=xdg-run/tray-icon:create",
"--talk-name=org.freedesktop.Notifications",
"--talk-name=org.kde.StatusNotifierWatcher",
"--talk-name=com.canonical.AppMenu.Registrar",
"--talk-name=org.mpris.MediaPlayer2.*"
],

View File

@@ -22,6 +22,9 @@ option('dbus', type: 'feature', value: 'auto',
option('libcanberra', type: 'feature', value: 'auto',
description: 'Support for sound alerts, Unix only'
)
option('appindicator', type: 'feature', value: 'auto',
description: 'Use Ayatana/AppIndicator-based tray backend when GTK3 is enabled'
)
# Install options
option('dbus-service-use-appid', type: 'boolean', value: false,

View File

@@ -40,15 +40,21 @@ if get_option('gtk3')
zoitechat_gtk_cflags += '-DHAVE_GTK3'
if host_machine.system() != 'windows'
appindicator_dep = dependency('ayatana-appindicator3-0.1', required: false)
if appindicator_dep.found()
zoitechat_gtk_deps += appindicator_dep
zoitechat_gtk_cflags += '-DHAVE_AYATANA_APPINDICATOR'
else
appindicator_dep = dependency('appindicator3-0.1', required: false)
appindicator_opt = get_option('appindicator')
if appindicator_opt.allowed()
appindicator_dep = dependency('ayatana-appindicator3-0.1', required: false)
if appindicator_dep.found()
zoitechat_gtk_deps += appindicator_dep
zoitechat_gtk_cflags += '-DHAVE_APPINDICATOR'
zoitechat_gtk_cflags += '-DHAVE_AYATANA_APPINDICATOR'
else
appindicator_dep = dependency('appindicator3-0.1', required: false)
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')
endif
endif
endif
endif

View File

@@ -311,6 +311,19 @@ tray_gtk3_icon_to_name (TrayIcon icon, char **allocated)
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
if (names && names[0])
{
/*
* Some StatusNotifier hosts (e.g. XFCE plugin combinations) can fail to
* resolve our desktop-id icon name even when GTK's icon theme lookup says
* it exists. Prefer an absolute PNG fallback for the app's normal icon so
* the tray item never renders as a blank placeholder.
*/
if (g_strcmp0 (names[0], ICON_NORMAL_NAME) == 0)
{
*allocated = tray_gtk3_fallback_icon_path_for_name (names[0]);
if (*allocated)
return *allocated;
}
theme = gtk_icon_theme_get_default ();
if (theme && gtk_icon_theme_has_icon (theme, names[0]))
return names[0];