aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils.c23
-rw-r--r--src/utils.h1
2 files changed, 23 insertions, 1 deletions
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";
}
@@ -201,6 +201,27 @@ is_mate ()
}
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 ()
{
const gchar *xdg_current_desktop;
diff --git a/src/utils.h b/src/utils.h
index 3143625..2666f02 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -30,5 +30,6 @@ gboolean is_unity();
gboolean is_gnome();
gboolean is_mate();
gboolean is_pantheon();
+gboolean is_xfce();
#endif /* __INDICATOR_POWER_UTILS_H__ */