tony / oxwm

feat: add AZERTY support (#164) Browse files
* feat: add AZERTY support to lua config (fixes #125)

* Update lua.zig

* fix(x11): dynamically refresh key grabs on MappingNotify

Resolves an issue where non-QWERTY keybinds (e.g., AZERTY special characters)
would fail to register if the keyboard layout was applied after the WM
initially started. The WM now listens for MappingNotify events and will
automatically ungrab and regrab keys whenever the keyboard map or
modifiers change.

---------

Co-authored-by: ozyz <ozyz@proton.me>
ozyz committed 2026-03-05 parent a8f88e9 commit bd9c85a4f33d291915b2fbc575049067012bb51b
Showing 3 changed files with 25 additions and 0 deletions. UnifiedSplit
+10 −0 src/config/lua.zig
@@ -1294,9 +1294,19 @@ fn keynameToKeysym(name: []const u8) ?u64 {
1294 .{ "bracketleft", 0x005b }, 1294 .{ "bracketleft", 0x005b },
1295 .{ "bracketright", 0x005d }, 1295 .{ "bracketright", 0x005d },
1296 .{ "backslash", 0x005c }, 1296 .{ "backslash", 0x005c },
1297 + .{ "colon", 0x003a },
1297 .{ "semicolon", 0x003b }, 1298 .{ "semicolon", 0x003b },
1298 .{ "apostrophe", 0x0027 }, 1299 .{ "apostrophe", 0x0027 },
1300 + .{ "quotedbl", 0x0022 },
1301 + .{ "ampersand", 0x0026 },
1302 + .{ "parenleft", 0x0028 },
1303 + .{ "parenright", 0x0029 },
1304 + .{ "underscore", 0x005f },
1299 .{ "grave", 0x0060 }, 1305 .{ "grave", 0x0060 },
1306 + .{ "agrave", 0x00e0 },
1307 + .{ "egrave", 0x00e8 },
1308 + .{ "ccedilla", 0x00e7 },
1309 + .{ "eacute", 0x00e9 },
1300 .{ "Left", 0xff51 }, 1310 .{ "Left", 0xff51 },
1301 .{ "Up", 0xff52 }, 1311 .{ "Up", 0xff52 },
1302 .{ "Right", 0xff53 }, 1312 .{ "Right", 0xff53 },
+10 −0 src/wm/handlers.zig
@@ -32,6 +32,7 @@ pub fn handleEvent(event: *xlib.XEvent, wm: *WindowManager) void {
32 .button_press => handleButtonPress(&event.xbutton, wm), 32 .button_press => handleButtonPress(&event.xbutton, wm),
33 .expose => handleExpose(&event.xexpose, wm), 33 .expose => handleExpose(&event.xexpose, wm),
34 .property_notify => handlePropertyNotify(&event.xproperty, wm), 34 .property_notify => handlePropertyNotify(&event.xproperty, wm),
35 + .mapping_notify => handleMappingNotify(&event.xmapping, wm),
35 else => {}, 36 else => {},
36 } 37 }
37 } 38 }
@@ -360,3 +361,12 @@ fn handlePropertyNotify(event: *xlib.XPropertyEvent, wm: *WindowManager) void {
360 core.updateWindowType(client, wm); 361 core.updateWindowType(client, wm);
361 } 362 }
362 } 363 }
364 +
365 +fn handleMappingNotify(event: *xlib.XMappingEvent, wm: *WindowManager) void {
366 + _ = xlib.XRefreshKeyboardMapping(event);
367 +
368 + if (event.request == xlib.MappingKeyboard or event.request == xlib.MappingModifier) {
369 + wm.ungrabKeybinds();
370 + wm.grabKeybinds();
371 + }
372 +}
+5 −0 src/x11/xlib.zig
@@ -268,3 +268,8 @@ pub const XC_fleur = c.XC_fleur;
268 pub const XAllowEvents = c.XAllowEvents; 268 pub const XAllowEvents = c.XAllowEvents;
269 pub const ReplayPointer = c.ReplayPointer; 269 pub const ReplayPointer = c.ReplayPointer;
270 pub const AnyButton = c.AnyButton; 270 pub const AnyButton = c.AnyButton;
271 +
272 +pub const XMappingEvent = c.XMappingEvent;
273 +pub const XRefreshKeyboardMapping = c.XRefreshKeyboardMapping;
274 +pub const MappingKeyboard = c.MappingKeyboard;
275 +pub const MappingModifier = c.MappingModifier;