diff options
| author | Ondrej Čerman <ondrej.cerman@gmail.com> | 2018-11-18 15:44:56 +0100 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-11-19 03:12:23 -0800 | 
| commit | 772ba83e7a83f22773909d95958e178144e7c577 (patch) | |
| tree | 3fa90e6804d6096726afa3d6be14a510dafa1d8b /modules/computer | |
| parent | 386afce7cba3fd4cd27b1e7a7129ab9f8891e810 (diff) | |
Added MATE version detection
Diffstat (limited to 'modules/computer')
| -rw-r--r-- | modules/computer/os.c | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/modules/computer/os.c b/modules/computer/os.c index fc370ee8..c42cc473 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -131,6 +131,28 @@ detect_gnome_version(void)      return NULL;  } + +static gchar * +detect_mate_version(void) +{ +    gchar *tmp; +    gchar *out; +    gboolean spawned; + +    spawned = g_spawn_command_line_sync( +        "mate-about --version", &out, NULL, NULL, NULL); +    if (spawned) { +        tmp = strstr(idle_free(out), _("MATE Desktop Environment ")); + +        if (tmp) { +            tmp += strlen(_("MATE Desktop Environment ")); +            return g_strdup_printf("MATE %s", strend(tmp, '\n')); +        } +    } + +    return NULL; +} +  static gchar *  detect_window_manager(void)  { @@ -192,6 +214,12 @@ detect_xdg_environment(const gchar *env_var)          if (maybe_kde)              return maybe_kde;      } +    if (g_str_equal(tmp, "MATE") || g_str_equal(tmp, "mate")) { +        gchar *maybe_mate = detect_mate_version(); + +        if (maybe_mate) +            return maybe_mate; +    }      return g_strdup(tmp);  } | 
