Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't block Alt + Shift when there is only one keyboard layout #1756

Merged
merged 7 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions data/gala.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
<update_contact>contact_at_elementary.io</update_contact>

<releases>
<release version="7.1.3" date="2023-09-13" urgency="medium">
<description>
<p>Improvements:</p>
<ul>
<li>Updated translations</li>
</ul>
</description>
<issues>
<issue url="https://github.com/elementary/gala/issues/1261">Alt + Shift unnecessarily blocked when there is only one keyboard layout</issue>
</issues>
</release>

<release version="7.1.2" date="2023-08-10" urgency="medium">
<description>
<p>Improvements:</p>
Expand Down
22 changes: 21 additions & 1 deletion src/KeyboardManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
*/

public class Gala.KeyboardManager : Object {
private const string[] BLOCKED_OPTIONS = {
"grp:alt_caps_toggle", "grp:alt_shift_toggle", "grp:alt_space_toggle",
"grp:shifts_toggle", "grp:caps_toggle", "grp:ctrl_alt_toggle",
"grp:ctrl_shift_toggle", "grp:shift_caps_toggle"
};

private static KeyboardManager? instance;
private static VariantType sources_variant_type;
private static GLib.Settings settings;
Expand Down Expand Up @@ -90,7 +96,21 @@ public class Gala.KeyboardManager : Object {
}
}

var xkb_options = settings.get_strv ("xkb-options");
if (layouts.length == 0) {
layouts = { "us" };
variants = { "" };
}

string[] xkb_options = {};
if (layouts.length == 1) {
foreach (unowned var option in settings.get_strv ("xkb-options")) {
if (!(option in BLOCKED_OPTIONS)) {
xkb_options += option;
}
}
} else {
xkb_options = settings.get_strv ("xkb-options");
}

var layout = string.joinv (",", layouts);
var variant = string.joinv (",", variants);
Expand Down