applied xkb-rules-switcher patch
This commit is contained in:
parent
30e30880d9
commit
93642f22d0
4 changed files with 42 additions and 15 deletions
|
@ -24,6 +24,7 @@ philosophy. Like dwm, dwl is:
|
||||||
- [hide_vacant_tags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/hide_vacant_tags)
|
- [hide_vacant_tags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/hide_vacant_tags)
|
||||||
- [setupenv](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/setupenv)
|
- [setupenv](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/setupenv)
|
||||||
- [sticky](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/sticky)
|
- [sticky](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/sticky)
|
||||||
|
- [xkb-rules-switcher](https://codeberg.org/wochap/dwl/src/branch/v0.6-b/xkb-rules-switcher/xkb-rules-switcher.patch)
|
||||||
|
|
||||||
## Getting Started:
|
## Getting Started:
|
||||||
|
|
||||||
|
|
17
config.def.h
17
config.def.h
|
@ -80,12 +80,16 @@ static const MonitorRule monrules[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* keyboard */
|
/* keyboard */
|
||||||
static const struct xkb_rule_names xkb_rules = {
|
static const struct xkb_rule_names xkb_rules[] = {
|
||||||
/* can specify fields: rules, model, layout, variant, options */
|
{
|
||||||
/* example:
|
/* can specify fields: rules, model, layout, variant, options */
|
||||||
.options = "ctrl:nocaps",
|
.layout = "us",
|
||||||
*/
|
.options = NULL,
|
||||||
.options = NULL,
|
},
|
||||||
|
{
|
||||||
|
.layout = "us",
|
||||||
|
.options = "compose:ralt",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int repeat_rate = 25;
|
static const int repeat_rate = 25;
|
||||||
|
@ -193,6 +197,7 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
{ MODKEY, XKB_KEY_w, switchxkbrule, {0} },
|
||||||
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||||
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||||
|
|
20
config.h
20
config.h
|
@ -20,7 +20,7 @@ static const char *fonts[] = {"inconsolata:size=11"};
|
||||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
|
||||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8" };
|
||||||
|
|
||||||
/* logging */
|
/* logging */
|
||||||
static int log_level = WLR_ERROR;
|
static int log_level = WLR_ERROR;
|
||||||
|
@ -77,13 +77,16 @@ static const MonitorRule monrules[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* keyboard */
|
/* keyboard */
|
||||||
static const struct xkb_rule_names xkb_rules = {
|
static const struct xkb_rule_names xkb_rules[] = {
|
||||||
/* can specify fields: rules, model, layout, variant, options */
|
{
|
||||||
/* example:
|
/* can specify fields: rules, model, layout, variant, options */
|
||||||
.options = "ctrl:nocaps",
|
.layout = "latam",
|
||||||
*/
|
.options = NULL,
|
||||||
.layout = "latam",
|
},
|
||||||
.options = NULL,
|
{
|
||||||
|
.layout = "us",
|
||||||
|
.options = NULL,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int repeat_rate = 25;
|
static const int repeat_rate = 25;
|
||||||
|
@ -181,6 +184,7 @@ static const Key keys[] = {
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, incnmaster, {.i = +1} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, incnmaster, {.i = +1} },
|
||||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_a, setmfact, {.f = -0.05f} },
|
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_a, setmfact, {.f = -0.05f} },
|
||||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_d, setmfact, {.f = +0.05f} },
|
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_d, setmfact, {.f = +0.05f} },
|
||||||
|
{ MODKEY, XKB_KEY_w, switchxkbrule, {0} },
|
||||||
/*
|
/*
|
||||||
{ MODKEY, XKB_KEY_h, incgaps, {.i = +1 } },
|
{ MODKEY, XKB_KEY_h, incgaps, {.i = +1 } },
|
||||||
{ MODKEY, XKB_KEY_l, incgaps, {.i = -1 } },
|
{ MODKEY, XKB_KEY_l, incgaps, {.i = -1 } },
|
||||||
|
|
19
dwl.c
19
dwl.c
|
@ -389,6 +389,7 @@ static void setup(void);
|
||||||
static void spawn(const Arg *arg);
|
static void spawn(const Arg *arg);
|
||||||
static void startdrag(struct wl_listener *listener, void *data);
|
static void startdrag(struct wl_listener *listener, void *data);
|
||||||
static int statusin(int fd, unsigned int mask, 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 tag(const Arg *arg);
|
||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
|
@ -461,6 +462,7 @@ static struct wl_listener lock_listener = {.notify = locksession};
|
||||||
static struct wlr_seat *seat;
|
static struct wlr_seat *seat;
|
||||||
static KeyboardGroup *kb_group;
|
static KeyboardGroup *kb_group;
|
||||||
static unsigned int cursor_mode;
|
static unsigned int cursor_mode;
|
||||||
|
static unsigned int xkb_rule_index = 0;
|
||||||
static Client *grabc;
|
static Client *grabc;
|
||||||
static int grabcx, grabcy; /* client-relative */
|
static int grabcx, grabcy; /* client-relative */
|
||||||
|
|
||||||
|
@ -1164,7 +1166,7 @@ createkeyboardgroup(void)
|
||||||
|
|
||||||
/* Prepare an XKB keymap and assign it to the keyboard group. */
|
/* Prepare an XKB keymap and assign it to the keyboard group. */
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
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)))
|
XKB_KEYMAP_COMPILE_NO_FLAGS)))
|
||||||
die("failed to compile keymap");
|
die("failed to compile keymap");
|
||||||
|
|
||||||
|
@ -3121,6 +3123,21 @@ statusin(int fd, unsigned int mask, void *data)
|
||||||
return 0;
|
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
|
void
|
||||||
tag(const Arg *arg)
|
tag(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue