File: Add-a-small-delay-to-ensure-keyboard-layout-defaults.patch

package info (click to toggle)
budgie-desktop 10.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,560 kB
  • sloc: ansic: 8,439; xml: 844; sh: 126; makefile: 42
file content (44 lines) | stat: -rw-r--r-- 1,523 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Forwarded: https://github.com/BuddiesOfBudgie/budgie-desktop/pull/168
Author: David Mohammed <fossfreedom@ubuntu.com>
Last-Update: 2022-11-27
Description: [PATCH] Add a small delay to ensure keyboard layout defaults to the
 current layout rather than the first available
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/budgie-desktop/+bug/1998214

---
 src/wm/keyboard.vala | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

--- a/src/wm/keyboard.vala
+++ b/src/wm/keyboard.vala
@@ -117,7 +117,7 @@
 			settings = new GLib.Settings.full (schema, null, null);
 			Signal.connect (settings, "changed", (Callback) set_keyboard_layout, this);
 
-			set_keyboard_layout ("current");
+			//set_keyboard_layout ("current");
 		}
 
 		[CCode (instance_pos = -1)]
@@ -128,9 +128,18 @@
 			settings.changed.connect(on_settings_changed);
 			update_fallback();
 
-			on_settings_changed("xkb-options");
-			on_settings_changed("sources");
-			on_settings_changed("current");
+			Timeout.add(500, () => {
+				/***
+				 * add a small delay to allow gnome-session keyboard handling to kick in
+				 * before switching to the current keyboard layout otherwise the layout
+				 * defaults to the first keyboard source
+				*/
+				on_settings_changed("xkb-options");
+				on_settings_changed("sources");
+				on_settings_changed("current");
+
+				return false;
+			});
 		}
 
 		public delegate void KeyHandlerFunc(Meta.Display display, Meta.Window? window, Clutter.KeyEvent? event, Meta.KeyBinding binding);