From 6578e2792b139580a6bbc40f6f2b9a6ddafbfd25 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Tue, 7 Jun 2016 10:18:08 +1200 Subject: Correctly use XDG_CURRENT_DESKTOP --- src/desktop.vala | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/desktop.vala b/src/desktop.vala index 35f5177..5adaaf1 100644 --- a/src/desktop.vala +++ b/src/desktop.vala @@ -211,11 +211,24 @@ class Desktop: Profile /// Actions /// + private bool is_desktop (string name) + { + var desktop_name_list = Environment.get_variable ("XDG_CURRENT_DESKTOP"); + if (desktop_name_list == null) + return false; + + foreach (var n in desktop_name_list.split (":")) + if (n == name) + return true; + + return false; + } + void show_settings (string panel) { if (Environment.get_variable ("MIR_SOCKET") != null) UrlDispatch.send ("settings:///system/bluetooth"); - else if (Environment.get_variable ("XDG_CURRENT_DESKTOP") == "Unity" && Environment.find_program_in_path ("unity-control-center") != null) + else if (is_desktop ("Unity") && Environment.find_program_in_path ("unity-control-center") != null) spawn_command_line_async ("unity-control-center " + panel); else spawn_command_line_async ("gnome-control-center " + panel); -- cgit v1.2.3