From edbfe02de667925953ccde3dabf2c44f7439e8b5 Mon Sep 17 00:00:00 2001 From: Johannes Herman Date: Sun, 28 Dec 2025 00:21:44 +0100 Subject: ignore CapsLock key in keybindings, misc config changes --- config.def.h | 47 ++++++++++++++++++++++++++++++----------------- dwl.c | 9 +++++---- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/config.def.h b/config.def.h index 1782f12..c85aa12 100644 --- a/config.def.h +++ b/config.def.h @@ -10,8 +10,8 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will static const int smartborders = 1; /* 1 means no outer gap when there is only one window */ static const int smartgaps = 1; /* 1 means no outer gap when there is only one window */ static int gaps = 0; /* 1 means gaps between windows are added */ -static const unsigned int gappx = 8; /* gap pixel between windows */ -static const unsigned int borderpx = 3; /* border pixel of windows */ +static const unsigned int gappx = 8; /* gap pixel between windows */ +static const unsigned int borderpx = 2; /* border pixel of windows */ static const float rootcolor[] = COLOR(0x282828ff); static const float bordercolor[] = COLOR(0x282828ee); static const float focuscolor[] = COLOR(0x689d6aff); @@ -132,14 +132,16 @@ static const int cursor_timeout = 2; #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ -static const char *termcmd[] = { "footclient", NULL }; -static const char *alttermcmd[] = { "foot", NULL }; +static const char *termcmd[] = { "foot", NULL }; + static const char *alttermcmd[] = { "footclient", NULL }; static const char *browsercmd[] = { "qutebrowser", NULL }; static const char *menucmd[] = { "bemenu-run", NULL }; -static const char *volume_raise[] = { "volume", "raise", NULL }; -static const char *volume_lower[] = { "volume", "lower", NULL }; -static const char *volume_mute[] = { "volume", "mute", NULL }; +static const char *volume_raise[] = { "volume", "raise", NULL }; +static const char *volume_lower[] = { "volume", "lower", NULL }; +static const char *volume_raise_small[] = { "volume", "+1%", NULL }; +static const char *volume_lower_small[] = { "volume", "-1%", NULL }; +static const char *volume_mute[] = { "volume", "mute", NULL }; static const Key keys[] = { /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */ @@ -147,12 +149,12 @@ static const Key keys[] = { /* Window managment */ { MODKEY, -1, XKB_KEY_d, spawn, {.v = menucmd} }, { MODKEY, -1, XKB_KEY_q, spawn, {.v = termcmd} }, - { MODKEY|SHIFT, -1, XKB_KEY_Q, spawn, {.v = alttermcmd} }, + { MODKEY|SHIFT, -1, XKB_KEY_q, spawn, {.v = alttermcmd} }, { MODKEY, -1, XKB_KEY_w, spawn, {.v = browsercmd} }, { MODKEY, -1, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, -1, XKB_KEY_k, focusstack, {.i = -1} }, - { MODKEY|SHIFT, -1, XKB_KEY_H, incnmaster, {.i = +1} }, - { MODKEY|SHIFT, -1, XKB_KEY_L, incnmaster, {.i = -1} }, + { MODKEY|SHIFT, -1, XKB_KEY_h, incnmaster, {.i = +1} }, + { MODKEY|SHIFT, -1, XKB_KEY_l, incnmaster, {.i = -1} }, { MODKEY, -1, XKB_KEY_h, setmfact, {.f = -0.05f} }, { MODKEY, -1, XKB_KEY_l, setmfact, {.f = +0.05f} }, { MODKEY, -1, XKB_KEY_f, togglefullscreen, {0} }, @@ -162,6 +164,9 @@ static const Key keys[] = { { MODKEY, -1, XKB_KEY_g, togglegaps, {0} }, { MODKEY, -1, XKB_KEY_p, togglesticky, {0} }, { MODKEY, -1, XKB_KEY_c, killclient, {0} }, + { MODKEY, -1, XKB_KEY_b, togglebar, {0} }, + { MODKEY, -1, XKB_KEY_o, spawn, SHCMD("linkhandler") }, + /* Layout */ { MODKEY, XKB_KEY_t, XKB_KEY_space, setlayout, {0} }, @@ -179,6 +184,7 @@ static const Key keys[] = { { MODKEY, XKB_KEY_n, XKB_KEY_c, spawn, SHCMD("vis pop-clock 1") }, { MODKEY, XKB_KEY_n, XKB_KEY_b, spawn, SHCMD("vis pop-bat 5") }, { MODKEY, XKB_KEY_n, XKB_KEY_n, spawn, SHCMD("vis pop-net 10") }, + { MODKEY, XKB_KEY_n, XKB_KEY_e, spawn, SHCMD("vis pop-con 10") }, { MODKEY, XKB_KEY_n, XKB_KEY_m, spawn, SHCMD("vis pop-mem 1") }, { MODKEY, XKB_KEY_n, XKB_KEY_s, spawn, SHCMD("vis pop-sens 1") }, { MODKEY, XKB_KEY_n, XKB_KEY_w, spawn, SHCMD("vis pop-yr 600") }, @@ -194,23 +200,30 @@ static const Key keys[] = { { MODKEY, XKB_KEY_m, XKB_KEY_s, spawn, SHCMD("menu-symbols") }, { MODKEY, XKB_KEY_m, XKB_KEY_m, spawn, SHCMD("menu-mpvhist") }, - /* Media */ + /* Volume */ { MODKEY|CTRL, -1, XKB_KEY_v, spawn, {.v = volume_mute } }, { MODKEY, -1, XKB_KEY_v, spawn, {.v = volume_raise } }, - { MODKEY|SHIFT, -1, XKB_KEY_V, spawn, {.v = volume_lower } }, - { MODKEY, -1, XKB_KEY_a, spawn, SHCMD("lampe raise") }, - { MODKEY|SHIFT, -1, XKB_KEY_A, spawn, SHCMD("lampe lower") }, + { MODKEY|SHIFT, -1, XKB_KEY_v, spawn, {.v = volume_lower } }, { 0, -1, XKB_KEY_XF86AudioMute, spawn, {.v = volume_mute } }, { 0, -1, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = volume_raise } }, { 0, -1, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = volume_lower } }, + { SHIFT, -1, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = volume_raise_small } }, + { SHIFT, -1, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = volume_lower_small } }, + + /* Backlight */ + { MODKEY, -1, XKB_KEY_a, spawn, SHCMD("lampe raise") }, + { MODKEY|SHIFT, -1, XKB_KEY_a, spawn, SHCMD("lampe lower") }, + { 0, -1, XKB_KEY_XF86MonBrightnessUp, spawn, SHCMD("lampe raise") }, + { 0, -1, XKB_KEY_XF86MonBrightnessDown, spawn, SHCMD("lampe lower") }, + { 0, -1, XKB_KEY_XF86AudioMicMute, spawn, SHCMD("mic mute") }, { 0, -1, XKB_KEY_XF86RotateWindows, spawn, SHCMD("warrelroll flip"), 1, 0, 0 }, { 0, -1, XKB_KEY_XF86TaskPane, spawn, SHCMD("warrelroll rotate"), 1, 0, 0 }, { 0, -1, XKB_KEY_XF86ScreenSaver, spawn, SHCMD("lock") }, - { 0, -1, XKB_KEY_XF86MonBrightnessUp, spawn, SHCMD("lampe raise") }, - { 0, -1, XKB_KEY_XF86MonBrightnessDown, spawn, SHCMD("lampe lower") }, { 0, -1, XKB_KEY_XF86Sleep, spawn, SHCMD("systemctl sleep") }, + /* Media */ + { MODKEY|SHIFT, -1, XKB_KEY_p, spawn, SHCMD("playerctl play-pause") }, { 0, -1, XKB_KEY_XF86AudioMedia, spawn, SHCMD("playerctl play-pause") }, { 0, -1, XKB_KEY_XF86AudioPlay, spawn, SHCMD("playerctl play-pause") }, { 0, -1, XKB_KEY_XF86AudioPause, spawn, SHCMD("playerctl play-pause") }, @@ -244,7 +257,7 @@ static const Key keys[] = { TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7), TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8), */ - { MODKEY|SHIFT, -1, XKB_KEY_M, quit, {0} }, + { MODKEY|SHIFT, -1, XKB_KEY_m, quit, {0} }, /* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */ { CTRL|WLR_MODIFIER_ALT,-1,XKB_KEY_Terminate_Server, quit, {0} }, diff --git a/dwl.c b/dwl.c index cfd3d07..800b3f4 100644 --- a/dwl.c +++ b/dwl.c @@ -1939,7 +1939,7 @@ keybinding(uint32_t mods, xkb_keysym_t sym, int on_press, int on_repeat, int on_ const Key *k; for (k = keys; k < END(keys); k++) { if (CLEANMASK(mods) == CLEANMASK(k->mod) - && sym == k->keysym + && xkb_keysym_to_lower(sym) == xkb_keysym_to_lower(k->keysym) && chainkey == -1 && k->chain == -1 && k->func) { @@ -1952,16 +1952,17 @@ keybinding(uint32_t mods, xkb_keysym_t sym, int on_press, int on_repeat, int on_ return 1; } } - else if (sym == k->keysym + else if (xkb_keysym_to_lower(sym) == xkb_keysym_to_lower(k->keysym) && chainkey != -1 - && k->chain == chainkey + && xkb_keysym_to_lower(k->chain) == xkb_keysym_to_lower(chainkey) && k->func) { k->func(&k->arg); chainkey = -1; return 1; } else if (CLEANMASK(mods) == CLEANMASK(k->mod) - && k->chain == (int)sym + // && k->chain == (int)sym + && xkb_keysym_to_lower(k->chain) == xkb_keysym_to_lower((int)sym) && chainkey == -1 && k->func) { chainkey = sym; -- cgit v1.2.3