applied xkb-rules-switcher patch
This commit is contained in:
parent
30e30880d9
commit
93642f22d0
4 changed files with 42 additions and 15 deletions
19
dwl.c
19
dwl.c
|
@ -389,6 +389,7 @@ static void setup(void);
|
|||
static void spawn(const Arg *arg);
|
||||
static void startdrag(struct wl_listener *listener, void *data);
|
||||
static int statusin(int fd, unsigned int mask, void *data);
|
||||
static void switchxkbrule(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
|
@ -461,6 +462,7 @@ static struct wl_listener lock_listener = {.notify = locksession};
|
|||
static struct wlr_seat *seat;
|
||||
static KeyboardGroup *kb_group;
|
||||
static unsigned int cursor_mode;
|
||||
static unsigned int xkb_rule_index = 0;
|
||||
static Client *grabc;
|
||||
static int grabcx, grabcy; /* client-relative */
|
||||
|
||||
|
@ -1164,7 +1166,7 @@ createkeyboardgroup(void)
|
|||
|
||||
/* Prepare an XKB keymap and assign it to the keyboard group. */
|
||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules,
|
||||
if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules[xkb_rule_index],
|
||||
XKB_KEYMAP_COMPILE_NO_FLAGS)))
|
||||
die("failed to compile keymap");
|
||||
|
||||
|
@ -3121,6 +3123,21 @@ statusin(int fd, unsigned int mask, void *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
switchxkbrule(const Arg *arg)
|
||||
{
|
||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
struct xkb_keymap *keymap;
|
||||
|
||||
xkb_rule_index = (xkb_rule_index + 1) % LENGTH(xkb_rules);
|
||||
if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules[xkb_rule_index],
|
||||
XKB_KEYMAP_COMPILE_NO_FLAGS)))
|
||||
die("failed to compile keymap");
|
||||
wlr_keyboard_set_keymap(&kb_group->wlr_group->keyboard, keymap);
|
||||
xkb_keymap_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
}
|
||||
|
||||
void
|
||||
tag(const Arg *arg)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue