Merge lp:~vikoadi/switchboard-plug-keyboard/fix-options into lp:~elementary-pantheon/switchboard-plug-keyboard/trunk

Proposed by Viko Adi Rahmawan
Status: Merged
Approved by: Cody Garver
Approved revision: 250
Merged at revision: 254
Proposed branch: lp:~vikoadi/switchboard-plug-keyboard/fix-options
Merge into: lp:~elementary-pantheon/switchboard-plug-keyboard/trunk
Diff against target: 185 lines (+36/-36)
2 files modified
src/Pages/Options/option_handler.vala (+30/-30)
src/Pages/Options/option_settings.vala (+6/-6)
To merge this branch: bzr merge lp:~vikoadi/switchboard-plug-keyboard/fix-options
Reviewer Review Type Date Requested Status
Viko Adi Rahmawan (community) Needs Resubmitting
elementary Pantheon team Pending
Review via email: mp+238176@code.launchpad.net

Commit message

* change to org.gnome.desktop.input-sources.xkb-options from org.gnome.libgnomekbd.keyboard.options
* change get_code and from_code because we dont need group+"\t" anymore

Description of the change

fix keyboard option setting
* change to org.gnome.desktop.input-sources.xkb-options from org.gnome.libgnomekbd.keyboard.options
* change get_code and from_code because we dont need group+"\t" anymore

To post a comment you must log in.
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

It seems that hard coded keyboard option doesnt work, should use libgnomedesktop XkbInfo one

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Just update the key, save libgnome-desktop-3.0 for later

review: Needs Resubmitting
Revision history for this message
Danielle Foré (danrabbit) wrote :

I can confirm this works for setting compose key to right alt. Super keys seem to not work for whatever reason. Might be eaten by Gala? Perhaps we shouldn't offer that as an option to consider
Bug #1355536 fixed.

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

which Super key that i need to remove?
personally i don't use compose key, but mapping Ctrl to Super does work so i don't think gala do something wrong.

248. By Viko Adi Rahmawan

fix style

249. By Viko Adi Rahmawan

remove non working key

250. By Viko Adi Rahmawan

little fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Pages/Options/option_handler.vala'
--- src/Pages/Options/option_handler.vala 2014-10-04 23:25:34 +0000
+++ src/Pages/Options/option_handler.vala 2014-10-16 16:00:53 +0000
@@ -12,7 +12,7 @@
12 this.multiple_selection = multiple_selection;12 this.multiple_selection = multiple_selection;
1313
14 if (multiple_selection == false) {14 if (multiple_selection == false) {
15 table.@set (_("None"), "");15 table.@set (_("None"), option+":");
16 }16 }
17 }17 }
1818
@@ -59,7 +59,7 @@
5959
60 public string? get_code (uint index, uint v) {60 public string? get_code (uint index, uint v) {
61 var item = items.nth (index).data;61 var item = items.nth (index).data;
62 return item.option + "\t" + item.table.get_values ().nth_data (v);62 return item.table.get_values ().nth_data (v);
63 }63 }
6464
65 public string get_name (uint index, uint v) {65 public string get_name (uint index, uint v) {
@@ -67,22 +67,21 @@
67 }67 }
6868
69 public bool from_code (string code, out uint l, out uint v) {69 public bool from_code (string code, out uint l, out uint v) {
70 var parts = code.split ("\t", 2);70 var parts = code.split (":", 2);
71 l = v = 0;71 l = v = 0;
72 if (parts[0] == null || parts[1] == null)72 if (parts[0] == null || parts[1] == null)
73 return false;73 return false;
7474
75 foreach (var item in items) {75 foreach (var item in items) {
76 v = 0;76 v = 0;
77 if (item.option == parts[0]) {77
78 foreach (var val in item.table.get_values ()) {78 foreach (var val in item.table.get_values ()) {
79 if (val == parts[1]) {79 if (val == code)
80 return true;80 return true;
81 }81
8282 v++;
83 v++;
84 }
85 }83 }
84
86 l++;85 l++;
87 }86 }
8887
@@ -200,31 +199,31 @@
200 item.set (_("Make Caps Lock an additional Super"), "caps:super");199 item.set (_("Make Caps Lock an additional Super"), "caps:super");
201 item.set (_("Make Caps Lock an additional Hyper"), "caps:hyper");200 item.set (_("Make Caps Lock an additional Hyper"), "caps:hyper");
202 item.set (_("Caps Lock toggles Shift so all keys are affected"), "caps:shiftlock");201 item.set (_("Caps Lock toggles Shift so all keys are affected"), "caps:shiftlock");
203 item.set (_("Caps Lock is disabled"), "caps:none");
204 item.set (_("Make Caps Lock an additional Control but keep the Caps_Lock keysym"), "caps:ctrl_modifier");202 item.set (_("Make Caps Lock an additional Control but keep the Caps_Lock keysym"), "caps:ctrl_modifier");
205 items.append (item);203 items.append (item);
206204
207 item = new Item (_("Alt/Win key behavior"), "altwin", false);205 item = new Item (_("Alt/Win key behavior"), "altwin", false);
208 item.set (_("Add the standard behavior to Menu key"), "compose:menu");206 item.set (_("Add the standard behavior to Menu key"), "altwin:menu");
209 item.set (_("Alt and Meta are on Alt keys"), "compose:meta_alt");207 item.set (_("Alt and Meta are on Alt keys"), "altwin:meta_alt");
210 item.set (_("Control is mapped to Win keys (and the usual Ctrl keys)"), "compose:ctrl_win");208 item.set (_("Control is mapped to Win keys (and the usual Ctrl keys)"), "altwin:ctrl_win");
211 item.set (_("Control is mapped to Alt keys, Alt is mapped to Win keys"), "compose:ctrl_alt_win");209 item.set (_("Control is mapped to Alt keys, Alt is mapped to Win keys"), "altwin:ctrl_alt_win");
212 item.set (_("Meta is mapped to Win keys"), "compose:meta_win");210 item.set (_("Meta is mapped to Win keys"), "altwin:meta_win");
213 item.set (_("Meta is mapped to Left Win"), "compose:left_meta_win");211 item.set (_("Meta is mapped to Left Win"), "altwin:left_meta_win");
214 item.set (_("Hyper is mapped to Win-keys"), "compose:hyper_win");212 item.set (_("Hyper is mapped to Win-keys"), "altwin:hyper_win");
215 item.set (_("Alt is mapped to Right Win, Super to Menu"), "compose:alt_super_win");213 item.set (_("Alt is mapped to Right Win, Super to Menu"), "altwin:alt_super_win");
216 item.set (_("Left Alt is swapped with Left Win"), "compose:swap_lalt_lwin");214 item.set (_("Alt is mapped to Win keys (and the usual Alt keys)"), "altwin:alt_win");
215 item.set (_("Alt is swapped with Win"), "altwin:swap_alt_win");
217 items.append (item);216 items.append (item);
218217
219 item = new Item (_("Compose key position"), "Compose key", true);218 item = new Item (_("Compose key position"), "Compose key", true);
220 item.set (_("Right Alt"), "compose:ralt");219 item.set (_("Right Alt"), "compose:ralt");
221 item.set (_("Left Win"), "compose:lwin");220 item.set (_("Left Win"), "compose:lwin-altgr");
222 item.set (_("Right Win"), "compose:rwin");221 item.set (_("Right Win"), "compose:rwin-altgr");
223 item.set (_("Menu"), "compose:menu");222 item.set (_("Menu"), "compose:menu-altgr");
224 item.set (_("Left Ctrl"), "compose:lctrl");223 item.set (_("Left Ctrl"), "compose:lctrl-altgr");
225 item.set (_("Right Ctrl"), "compose:rctrl");224 item.set (_("Right Ctrl"), "compose:rctrl-altgr");
226 item.set (_("Caps Lock"), "compose:caps");225 item.set (_("Caps Lock"), "compose:caps-altgr");
227 item.set (_("<Less/Greater>"), "compose:102");226 item.set (_("<Less/Greater>"), "compose:102-altgr");
228 item.set (_("Pause"), "compose:paus");227 item.set (_("Pause"), "compose:paus");
229 item.set (_("PrtSc"), "compose:prsc");228 item.set (_("PrtSc"), "compose:prsc");
230 item.set (_("Scroll Lock"), "compose:sclk");229 item.set (_("Scroll Lock"), "compose:sclk");
@@ -255,7 +254,7 @@
255 items.append (item);254 items.append (item);
256255
257 item = new Item (_("Key to choose 5th level"), "lv5", true);256 item = new Item (_("Key to choose 5th level"), "lv5", true);
258 item.set (_("<Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:lalt_switch_lock");257 item.set (_("<Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:lsgt_switch_lock");
259 item.set (_("Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:ralt_switch_lock");258 item.set (_("Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:ralt_switch_lock");
260 item.set (_("Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:lwin_switch_lock");259 item.set (_("Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:lwin_switch_lock");
261 item.set (_("Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:rwin_switch_lock");260 item.set (_("Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:rwin_switch_lock");
@@ -272,7 +271,7 @@
272 item.set (_("Non-breakable space character at fourth level, thin non-breakable space character at sixth level (via Ctrl+Shift)"), "nbsp:level4nl");271 item.set (_("Non-breakable space character at fourth level, thin non-breakable space character at sixth level (via Ctrl+Shift)"), "nbsp:level4nl");
273 item.set (_("Zero-width non-joiner character at second level"), "nbsp:zwnj2");272 item.set (_("Zero-width non-joiner character at second level"), "nbsp:zwnj2");
274 item.set (_("Zero-width non-joiner character at second level, zero-width joiner character at third level"), "nbsp:zwnj2zwj3");273 item.set (_("Zero-width non-joiner character at second level, zero-width joiner character at third level"), "nbsp:zwnj2zwj3");
275 item.set (_("Zero-width non-joiner character at second level, zero-width joiner character at third level, non-breakable space character at fourth level"), "zwnj2zwj3nb4");274 item.set (_("Zero-width non-joiner character at second level, zero-width joiner character at third level, non-breakable space character at fourth level"), "nbsp:zwnj2zwj3nb4");
276 item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level"), "nbsp:zwnj2nb3");275 item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level"), "nbsp:zwnj2nb3");
277 item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level, nothing at fourth level"), "nbsp:zwnj2nb3s");276 item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level, nothing at fourth level"), "nbsp:zwnj2nb3s");
278 item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level, zero-width joiner at fourth level"), "nbsp:zwnj2nb3zwj4");277 item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level, zero-width joiner at fourth level"), "nbsp:zwnj2nb3zwj4");
@@ -289,6 +288,7 @@
289 item = new Item (_("Adding Esperanto circumflexes (supersigno)"), "esperanto", false);288 item = new Item (_("Adding Esperanto circumflexes (supersigno)"), "esperanto", false);
290 item.set (_("To the corresponding key in a Qwerty keyboard"), "esperanto:qwerty");289 item.set (_("To the corresponding key in a Qwerty keyboard"), "esperanto:qwerty");
291 item.set (_("To the corresponding key in a Dvorak keyboard"), "esperanto:dvorak");290 item.set (_("To the corresponding key in a Dvorak keyboard"), "esperanto:dvorak");
291 item.set (_("To the corresponding key in a Colemak layout"), "esperanto:colemak");
292 items.append (item);292 items.append (item);
293293
294 item = new Item (_("Key sequence to kill the X server"), "terminate", true);294 item = new Item (_("Key sequence to kill the X server"), "terminate", true);
295295
=== modified file 'src/Pages/Options/option_settings.vala'
--- src/Pages/Options/option_settings.vala 2014-01-06 17:12:27 +0000
+++ src/Pages/Options/option_settings.vala 2014-10-16 16:00:53 +0000
@@ -13,7 +13,7 @@
13 13
14 public OptionSettings()14 public OptionSettings()
15 {15 {
16 var schema_name = "org.gnome.libgnomekbd.keyboard";16 var schema_name = "org.gnome.desktop.input-sources";
17 var schema_source = GLib.SettingsSchemaSource.get_default ();17 var schema_source = GLib.SettingsSchemaSource.get_default ();
18 18
19 // check if schema exists19 // check if schema exists
@@ -28,7 +28,7 @@
28 apply ();28 apply ();
29 }29 }
30 30
31 settings.changed["options"].connect (() => {31 settings.changed["xkb-options"].connect (() => {
32 uint[] old_groups = groups;32 uint[] old_groups = groups;
33 uint[] old_options = options;33 uint[] old_options = options;
34 34
@@ -49,7 +49,7 @@
49 // emittedwhen the options are changed from an external program49 // emittedwhen the options are changed from an external program
50 public signal void external_change ();50 public signal void external_change ();
51 51
52 // parse the "options" key and store the values in options[] and groups[]52 // parse the "xkb-options" key and store the values in options[] and groups[]
53 public bool parse ()53 public bool parse ()
54 {54 {
55 groups = {};55 groups = {};
@@ -57,7 +57,7 @@
57 57
58 uint group, option;58 uint group, option;
59 59
60 foreach (var code in settings.get_strv ("options"))60 foreach (var code in settings.get_strv ("xkb-options"))
61 {61 {
62 var add = true;62 var add = true;
63 63
@@ -86,7 +86,7 @@
86 {86 {
87 groups = {};87 groups = {};
88 options = {};88 options = {};
89 settings.set_strv ("options", null);89 settings.set_strv ("xkb-options", null);
90 }90 }
91 91
92 92
@@ -99,7 +99,7 @@
99 for (int i = 0; i < groups.length; i++)99 for (int i = 0; i < groups.length; i++)
100 tmp += option_handler.get_code (groups[i], options[i]);100 tmp += option_handler.get_code (groups[i], options[i]);
101 101
102 settings.set_strv ("options", tmp);102 settings.set_strv ("xkb-options", tmp);
103 }103 }
104 104
105 public void add (uint group, uint option) {105 public void add (uint group, uint option) {

Subscribers

People subscribed via source and target branches