From 58e44269281afac5a1cd28fcc24fe0b355496e4b Mon Sep 17 00:00:00 2001 From: lenemter Date: Wed, 13 Sep 2023 15:47:41 +0900 Subject: [PATCH 1/3] Don't block `Alt + Shift` when there is only one keyboard layout --- src/KeyboardManager.vala | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/KeyboardManager.vala b/src/KeyboardManager.vala index d0bc4bd88..b13462649 100644 --- a/src/KeyboardManager.vala +++ b/src/KeyboardManager.vala @@ -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; @@ -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); From 814f8202559de0b1a7840e5536a14cdd65001bea Mon Sep 17 00:00:00 2001 From: lenemter Date: Wed, 13 Sep 2023 15:48:36 +0900 Subject: [PATCH 2/3] Update metainfo --- data/gala.metainfo.xml.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data/gala.metainfo.xml.in b/data/gala.metainfo.xml.in index 48d912be5..0983fbf75 100644 --- a/data/gala.metainfo.xml.in +++ b/data/gala.metainfo.xml.in @@ -25,6 +25,18 @@ contact_at_elementary.io + + +

Improvements:

+
    +
  • Updated translations
  • +
+
+ + Alt + Shift unnecessarily blocked when there is only one keyboard layout + +
+

Improvements:

From 64532eba4263351d5b8d7f877bf139a84ec2fb72 Mon Sep 17 00:00:00 2001 From: lenemter Date: Sat, 16 Sep 2023 13:54:41 +0900 Subject: [PATCH 3/3] Fix lint --- src/KeyboardManager.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KeyboardManager.vala b/src/KeyboardManager.vala index b13462649..f1ddae91f 100644 --- a/src/KeyboardManager.vala +++ b/src/KeyboardManager.vala @@ -106,7 +106,7 @@ public class Gala.KeyboardManager : Object { 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");