Merge lp:~laney/unity-settings-daemon/lp1554878 into lp:unity-settings-daemon

Proposed by Iain Lane
Status: Merged
Approved by: Iain Lane
Approved revision: 4154
Merged at revision: 4155
Proposed branch: lp:~laney/unity-settings-daemon/lp1554878
Merge into: lp:unity-settings-daemon
Diff against target: 42 lines (+24/-1)
1 file modified
plugins/keyboard/gsd-keyboard-manager.c (+24/-1)
To merge this branch: bzr merge lp:~laney/unity-settings-daemon/lp1554878
Reviewer Review Type Date Requested Status
Iain Lane Approve
Review via email: mp+307407@code.launchpad.net

Commit message

Check XDG_CURRENT_DESKTOP properly in the keyboard plugin

Description of the change

Check XDG_CURRENT_DESKTOP properly in the keyboard plugin

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

Self approvin'

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/keyboard/gsd-keyboard-manager.c'
2--- plugins/keyboard/gsd-keyboard-manager.c 2016-05-20 16:50:05 +0000
3+++ plugins/keyboard/gsd-keyboard-manager.c 2016-10-03 10:08:04 +0000
4@@ -977,6 +977,29 @@
5 }
6 }
7
8+static gboolean
9+in_desktop (const gchar *name)
10+{
11+ const gchar *desktop_name_list;
12+ gchar **names;
13+ gboolean in_list = FALSE;
14+ gint i;
15+
16+ desktop_name_list = g_getenv ("XDG_CURRENT_DESKTOP");
17+ if (!desktop_name_list)
18+ return FALSE;
19+
20+ names = g_strsplit (desktop_name_list, ":", -1);
21+ for (i = 0; names[i] && !in_list; i++)
22+ if (strcmp (names[i], name) == 0) {
23+ in_list = TRUE;
24+ break;
25+ }
26+ g_strfreev (names);
27+
28+ return in_list;
29+}
30+
31 static gchar *
32 prepare_xkb_options (GsdKeyboardManager *manager,
33 guint n_sources,
34@@ -1001,7 +1024,7 @@
35 * and doesn't call us so we can't set the group switching XKB
36 * option in the first place otherwise the X server's switch
37 * will take effect and we get a broken configuration. */
38- if (n_sources < 2 || g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0)
39+ if (n_sources < 2 || in_desktop ("Unity"))
40 strip_xkb_option (options, "grp:");
41
42 options_str = build_xkb_options_string (options);

Subscribers

People subscribed via source and target branches