diff --git a/.github/workflows/appimage-build.yml b/.github/workflows/appimage-build.yml index 36e49518..ded95a3b 100644 --- a/.github/workflows/appimage-build.yml +++ b/.github/workflows/appimage-build.yml @@ -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: | diff --git a/flatpak/net.zoite.Zoitechat.json b/flatpak/net.zoite.Zoitechat.json index 4865d999..b7436edd 100644 --- a/flatpak/net.zoite.Zoitechat.json +++ b/flatpak/net.zoite.Zoitechat.json @@ -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.*" ], diff --git a/meson_options.txt b/meson_options.txt index faa9f665..0bdf5051 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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, diff --git a/src/fe-gtk/meson.build b/src/fe-gtk/meson.build index b66dfd73..65993c4e 100644 --- a/src/fe-gtk/meson.build +++ b/src/fe-gtk/meson.build @@ -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 diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index ff83f0e0..84bd3cec 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -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];