summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-09-03 06:51:47 -0400
committerLuke from DC <[email protected]>2026-09-03 21:53:25 +0000
commit927e9dc5481c55bd1c5565c4a64606494f6bcd45 (patch)
tree0ec7f6cfdf1f54a532173a8c51d9c1bcb57bb3f1
parent623df46e728bf79d0cdcb31e99046dbc308cd2b4 (diff)
downloadmate-settings-daemon-master.tar.bz2
mate-settings-daemon-master.tar.xz
Make ayatana-appindicator dependency optionalHEADmaster
The wlrandr plugin hard-linked ayatana-appindicator3, making it a mandatory requirement of Wayland builds. This patch adds an --enable-appindicator configure option to make sure Wayland support is no longer silently disabled when appindicator is missing. Fixes #442
-rw-r--r--configure.ac31
-rw-r--r--plugins/wlrandr/msd-wlrandr-manager.c23
2 files changed, 47 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 3378f6b..911a8bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,28 @@ esac
AC_SUBST([MSD_PLUGIN_LDFLAGS])
dnl ---------------------------------------------------------------------------
+dnl - Ayatana AppIndicator
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_ENABLE(appindicator,
+ AS_HELP_STRING([--enable-appindicator], [Enable ayatana appindicator support (default: auto)]),
+ [case "${enableval}" in
+ yes|no|auto) enable_appindicator=${enableval} ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-appindicator) ;;
+ esac],
+ enable_appindicator=auto)
+
+have_appindicator=no
+if test "x${enable_appindicator}" != "xno"; then
+ PKG_CHECK_MODULES(APPINDICATOR, ayatana-appindicator3-0.1,
+ [have_appindicator=yes
+ AC_DEFINE(HAVE_APP_INDICATOR, 1, [Define if ayatana appindicator support is enabled])],
+ [if test "x${enable_appindicator}" = "xyes"; then
+ AC_MSG_ERROR([Ayatana appindicator support requested but ayatana-appindicator3-0.1 not found])
+ fi])
+fi
+
+dnl ---------------------------------------------------------------------------
dnl - Wayland
dnl ---------------------------------------------------------------------------
@@ -126,17 +148,11 @@ if test "x${enable_wayland}" != "xno"; then
fi
if test "x${have_wayland}" = "xyes"; then
- PKG_CHECK_MODULES(APPINDICATOR, ayatana-appindicator3-0.1,
- [have_wayland=yes],
- [have_wayland=no])
- fi
-
- if test "x${have_wayland}" = "xyes"; then
AC_DEFINE(HAVE_WAYLAND, 1, [Define if Wayland support is enabled])
fi
if test "x${have_wayland}" = "xno" -a "x${enable_wayland}" = "xyes"; then
- AC_MSG_ERROR([Wayland support requested but the required Wayland libraries (GTK+ Wayland backend, wayland-client, wayland-protocols, gtk-layer-shell or ayatana-appindicator) are missing])
+ AC_MSG_ERROR([Wayland support requested but the required Wayland libraries (GTK+ Wayland backend, wayland-client, wayland-protocols or gtk-layer-shell) are missing])
fi
fi
AM_CONDITIONAL(BUILD_WAYLAND, test "x${have_wayland}" = "xyes")
@@ -559,6 +575,7 @@ Configure summary:
Libmatemixer support ....: ${have_libmatemixer}
Smartcard support .......: ${have_smartcard_support}
RFKill support ..........: ${enable_rfkill}
+ Appindicator support ....: ${have_appindicator}
Wayland support .........: ${have_wayland}
Wayland protocols dir ...: ${WAYLAND_PROTOCOLS_DATADIR}
${NSS_DATABASE:+\
diff --git a/plugins/wlrandr/msd-wlrandr-manager.c b/plugins/wlrandr/msd-wlrandr-manager.c
index 7258d78..7240ae8 100644
--- a/plugins/wlrandr/msd-wlrandr-manager.c
+++ b/plugins/wlrandr/msd-wlrandr-manager.c
@@ -32,7 +32,9 @@
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-desktop-utils.h>
+#ifdef HAVE_APP_INDICATOR
#include <libayatana-appindicator/app-indicator.h>
+#endif
#include <wayland-client.h>
#include "wlr-output-management-unstable-v1-client-protocol.h"
@@ -161,7 +163,9 @@ struct MsdWlrandrManagerPrivate {
gboolean initial_config_applied;
struct zwlr_output_configuration_v1 *pending_config;
gboolean probing;
+#ifdef HAVE_APP_INDICATOR
AppIndicator *indicator;
+#endif
GtkWidget *menu;
GtkWidget *confirm_dialog;
guint icon_changed_id;
@@ -2659,8 +2663,13 @@ rebuild_menu (MsdWlrandrManager *manager)
GtkWidget *menu;
GList *l;
+#ifndef HAVE_APP_INDICATOR
+ /* there is no tray icon to attach the menu to */
+ return;
+#else
if (priv->indicator == NULL)
return;
+#endif
menu = gtk_menu_new ();
@@ -2684,7 +2693,9 @@ rebuild_menu (MsdWlrandrManager *manager)
gtk_widget_destroy (priv->menu);
priv->menu = menu;
+#ifdef HAVE_APP_INDICATOR
app_indicator_set_menu (priv->indicator, GTK_MENU (menu));
+#endif
}
/* ------------------------------------------------------------------ *
@@ -2697,10 +2708,14 @@ start_or_stop_icon (MsdWlrandrManager *manager)
gboolean show = g_settings_get_boolean (manager->priv->settings, CONF_KEY_SHOW_NOTIFICATION_ICON);
if (show) {
+#ifdef HAVE_APP_INDICATOR
app_indicator_set_status (manager->priv->indicator, APP_INDICATOR_STATUS_ACTIVE);
+#endif
rebuild_menu (manager);
} else {
+#ifdef HAVE_APP_INDICATOR
app_indicator_set_status (manager->priv->indicator, APP_INDICATOR_STATUS_PASSIVE);
+#endif
}
}
@@ -2755,8 +2770,10 @@ msd_wlrandr_manager_finalize (GObject *object)
g_object_unref (priv->settings);
}
+#ifdef HAVE_APP_INDICATOR
if (priv->indicator != NULL)
g_object_unref (priv->indicator);
+#endif
if (priv->menu != NULL)
gtk_widget_destroy (priv->menu);
if (priv->confirm_dialog != NULL)
@@ -2833,14 +2850,18 @@ msd_wlrandr_manager_start (MsdWlrandrManager *manager, GError **error)
wl_registry_add_listener (priv->registry, &registry_listener, manager);
wl_display_flush (priv->display);
+#ifdef HAVE_APP_INDICATOR
priv->indicator = app_indicator_new ("org.mate.settingsdaemon.wlrandr",
MSD_WLRANDR_ICON_NAME,
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
app_indicator_set_title (priv->indicator, _("Configure display settings"));
+#endif
icon_settings = g_settings_new ("org.mate.interface");
+#ifdef HAVE_APP_INDICATOR
if (g_settings_get_boolean (icon_settings, "menus-have-icons"))
app_indicator_set_icon_theme_path (priv->indicator, NULL);
+#endif
g_object_unref (icon_settings);
priv->icon_changed_id = g_signal_connect (priv->settings, "changed::" CONF_KEY_SHOW_NOTIFICATION_ICON,
@@ -2906,11 +2927,13 @@ msd_wlrandr_manager_stop (MsdWlrandrManager *manager)
priv->settings = NULL;
}
+#ifdef HAVE_APP_INDICATOR
if (priv->indicator != NULL) {
app_indicator_set_status (priv->indicator, APP_INDICATOR_STATUS_PASSIVE);
g_object_unref (priv->indicator);
priv->indicator = NULL;
}
+#endif
if (priv->menu != NULL) {
gtk_widget_destroy (priv->menu);