diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-03-21 07:13:29 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-03-21 07:13:29 +0100 |
commit | 1872fc53a0004997ca87fcae5619b0c173401b12 (patch) | |
tree | b196295de0047f4a8355f5bb1dcb2f801803f067 /src | |
parent | 41bf160d2e1efc5185d2f26431394f3feffa0ce4 (diff) | |
download | ayatana-indicator-power-1872fc53a0004997ca87fcae5619b0c173401b12.tar.gz ayatana-indicator-power-1872fc53a0004997ca87fcae5619b0c173401b12.tar.bz2 ayatana-indicator-power-1872fc53a0004997ca87fcae5619b0c173401b12.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.c | 23 | ||||
-rw-r--r-- | src/utils.h | 1 |
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__ */ |