Skip to content

Commit 844eb95

Browse files
authored
Don't block Alt + Shift when there is only one keyboard layout (#1756)
1 parent b9744dd commit 844eb95

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

data/gala.metainfo.xml.in

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@
2525
<update_contact>contact_at_elementary.io</update_contact>
2626

2727
<releases>
28+
<release version="7.1.3" date="2023-09-13" urgency="medium">
29+
<description>
30+
<p>Improvements:</p>
31+
<ul>
32+
<li>Updated translations</li>
33+
</ul>
34+
</description>
35+
<issues>
36+
<issue url="https://github.com/elementary/gala/issues/1261">Alt + Shift unnecessarily blocked when there is only one keyboard layout</issue>
37+
</issues>
38+
</release>
39+
2840
<release version="7.1.2" date="2023-08-10" urgency="medium">
2941
<description>
3042
<p>Improvements:</p>

src/KeyboardManager.vala

+21-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
*/
66

77
public class Gala.KeyboardManager : Object {
8+
private const string[] BLOCKED_OPTIONS = {
9+
"grp:alt_caps_toggle", "grp:alt_shift_toggle", "grp:alt_space_toggle",
10+
"grp:shifts_toggle", "grp:caps_toggle", "grp:ctrl_alt_toggle",
11+
"grp:ctrl_shift_toggle", "grp:shift_caps_toggle"
12+
};
13+
814
private static KeyboardManager? instance;
915
private static VariantType sources_variant_type;
1016
private static GLib.Settings settings;
@@ -90,7 +96,21 @@ public class Gala.KeyboardManager : Object {
9096
}
9197
}
9298

93-
var xkb_options = settings.get_strv ("xkb-options");
99+
if (layouts.length == 0) {
100+
layouts = { "us" };
101+
variants = { "" };
102+
}
103+
104+
string[] xkb_options = {};
105+
if (layouts.length == 1) {
106+
foreach (unowned var option in settings.get_strv ("xkb-options")) {
107+
if (!(option in BLOCKED_OPTIONS)) {
108+
xkb_options += option;
109+
}
110+
}
111+
} else {
112+
xkb_options = settings.get_strv ("xkb-options");
113+
}
94114

95115
var layout = string.joinv (",", layouts);
96116
var variant = string.joinv (",", variants);

0 commit comments

Comments
 (0)