keyboard: allow applying keyboard layout per window

Fixes #1076

It can be enabled with a config like

~/.config/labwc/rc.xml:
<keyboard layoutScope="window">

~/.config/labwc/environment:
XKB_DEFAULT_LAYOUT=de,us
XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,grp_led:scroll

With a configuration like this each window should now remember
the active keyboard layout when switching between windows.

By default, the keyboard layout keeps being a global state.
This commit is contained in:
Consolatis 2023-09-07 16:41:47 +02:00 committed by Johan Malm
parent f1c2664ad1
commit 984aeb0b0b
9 changed files with 66 additions and 3 deletions

View file

@ -735,6 +735,12 @@ entry(xmlNode *node, char *nodename, char *content)
rc.repeat_delay = atoi(content);
} else if (!strcasecmp(nodename, "numlock.keyboard")) {
set_bool(content, &rc.kb_numlock_enable);
} else if (!strcasecmp(nodename, "layoutScope.keyboard")) {
/*
* This can be changed to an enum later on
* if we decide to also support "application".
*/
rc.kb_layout_per_window = !strcasecmp(content, "window");
} else if (!strcasecmp(nodename, "screenEdgeStrength.resistance")) {
rc.screen_edge_strength = atoi(content);
} else if (!strcasecmp(nodename, "range.snapping")) {
@ -953,6 +959,7 @@ rcxml_init(void)
rc.repeat_rate = 25;
rc.repeat_delay = 600;
rc.kb_numlock_enable = true;
rc.kb_layout_per_window = false;
rc.screen_edge_strength = 20;
rc.snap_edge_range = 1;