en-keycodes: make it work with grp:caps_toggle

This commit is contained in:
Nikita Ivanov 2025-11-30 23:27:17 +01:00
parent e240c8bf84
commit e4130ff865
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
2 changed files with 11 additions and 9 deletions

View File

@ -6,6 +6,6 @@ Always use the English keymap to get keycodes, so key bindings work even when us
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/en-keycodes/en-keycodes.patch)
### Authors
- [ForzCross](https://codeberg.org/ForzCross)
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
- [ForzCross](https://codeberg.org/ForzCross)
- [dimkr](https://codeberg.org/dimkr) (<dima@dimakrasner.com>)

View File

@ -1,21 +1,21 @@
From cd61fac9cb6e9d0172e2f7a01e6a514d676ba5f0 Mon Sep 17 00:00:00 2001
From 556e47f7ce7f729ecc1b285ece0c82744741c81c Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Tue, 4 Feb 2025 23:53:11 +0100
Date: Sun, 30 Nov 2025 23:16:53 +0100
Subject: [PATCH] Always use the English keymap to get keycodes
---
dwl.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
dwl.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/dwl.c b/dwl.c
index def2562..c299365 100644
index def2562..31e98ca 100644
--- a/dwl.c
+++ b/dwl.c
@@ -413,6 +413,11 @@ static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
+static const struct xkb_rule_names en_rules = {.layout = "us"};
+static struct xkb_rule_names en_rules;
+static struct xkb_context *en_context;
+static struct xkb_keymap *en_keymap;
+static struct xkb_state *en_state;
@ -57,11 +57,13 @@ index def2562..c299365 100644
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
@@ -2607,6 +2618,10 @@ setup(void)
@@ -2607,6 +2618,12 @@ setup(void)
* pointer, touch, and drawing tablet device. We also rig up a listener to
* let us know when new input devices are available on the backend.
*/
+ en_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+ en_rules = xkb_rules;
+ en_rules.layout = "us";
+ en_keymap = xkb_keymap_new_from_names(en_context, &en_rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ en_state = xkb_state_new(en_keymap);
@ -69,5 +71,5 @@ index def2562..c299365 100644
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard);
--
2.48.1
2.51.2