diff --git a/config.def.h b/config.def.h index d135c69..6c43f83 100644 --- a/config.def.h +++ b/config.def.h @@ -65,6 +65,9 @@ static const struct xkb_rule_names xkb_rules = { .options = NULL, }; +/* NumLock on at startup */ +static const int numlock = 1; + static const int repeat_rate = 25; static const int repeat_delay = 600; diff --git a/config.h b/config.h index 2fe33ec..c14dc6d 100644 --- a/config.h +++ b/config.h @@ -69,6 +69,9 @@ static const struct xkb_rule_names xkb_rules = { .options = "grp:alt_shift_toggle", }; +/* NumLock on at startup */ +static const int numlock = 1; + static const int repeat_rate = 25; static const int repeat_delay = 600; diff --git a/dwl.c b/dwl.c index d18e7b0..4986765 100644 --- a/dwl.c +++ b/dwl.c @@ -1232,6 +1232,15 @@ createkeyboardgroup(void) die("failed to compile keymap"); wlr_keyboard_set_keymap(&group->wlr_group->keyboard, keymap); + + /* Start with NumLock on: lock the keymap's NumLock modifier (Mod2) */ + if (numlock) { + xkb_mod_index_t mod = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM); + if (mod != XKB_MOD_INVALID) + wlr_keyboard_notify_modifiers(&group->wlr_group->keyboard, + 0, 0, 1u << mod, 0); + } + xkb_keymap_unref(keymap); xkb_context_unref(context);