From 1872fc53a0004997ca87fcae5619b0c173401b12 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 21 Mar 2018 07:13:29 +0100 Subject: src/utils.(c|h): Use XDG_CURRENT_DESKTOP for XFCE as well, in order to detect that -power indicator is used on an XFCE desktop. --- src/utils.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 55a746b..17e3a9c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -102,7 +102,7 @@ utils_handle_settings_request (void) else #endif /* XFCE does not set XDG_CURRENT_DESKTOP, it seems... */ - if ((!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xubuntu")) || (!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xfce"))) + if (is_xfce()) { control_center_cmd = "xfce4-power-manager-settings"; } @@ -200,6 +200,27 @@ is_mate () return FALSE; } +gboolean +is_xfce () +{ + const gchar *xdg_current_desktop; + gchar **desktop_names; + int i; + + xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); + if (xdg_current_desktop != NULL) { + desktop_names = g_strsplit (xdg_current_desktop, ":", 0); + for (i = 0; desktop_names[i]; ++i) { + if (!g_strcmp0 (desktop_names[i], "XFCE")) { + g_strfreev (desktop_names); + return TRUE; + } + } + g_strfreev (desktop_names); + } + return FALSE; +} + gboolean is_pantheon () { -- cgit v1.2.3