From feac567278b13cd1ed958403e15c266d4dea2de4 Mon Sep 17 00:00:00 2001 From: Zuki Air Date: Fri, 1 Aug 2025 16:32:34 +0100 Subject: [PATCH] riverctl patch: fix the hardcoded keysyms --- patches/riverctl/README.md | 1 - patches/riverctl/riverctl.patch | 102 ++------------------------------ 2 files changed, 6 insertions(+), 97 deletions(-) diff --git a/patches/riverctl/README.md b/patches/riverctl/README.md index 0130386..44eb094 100644 --- a/patches/riverctl/README.md +++ b/patches/riverctl/README.md @@ -4,7 +4,6 @@ This protocol allows sending args to dwl to execute functions via the included d This is used to allow changing rules and binds, at runtime via dwlctl. Most of this patch is stored in river-control.h, It contains a list of functions which can be called via dwlctl so adding support for new functions is as simple as adding them to the list. -Also Note this is also the case for keys in keybinds so you may need to modify that list as well if you use a layout that uses a diffrent keycode, or just a key not included in that list. This patches main intended use case is to have a startup script that calls dwlctl a bunch to add all the binds/rules you want, without the need of restarting dwl if you make any changes to the list of binds/rules. diff --git a/patches/riverctl/riverctl.patch b/patches/riverctl/riverctl.patch index 89bc093..8c068d7 100644 --- a/patches/riverctl/riverctl.patch +++ b/patches/riverctl/riverctl.patch @@ -1,4 +1,4 @@ -From db7ec8a92252bf7ec69f2cbff6a416e2bd363697 Mon Sep 17 00:00:00 2001 +From 5b6f945beea355708aa8d9f98feb089510d5f1ef Mon Sep 17 00:00:00 2001 From: Zuki Air Date: Sun, 27 Jul 2025 11:30:32 +0100 Subject: [PATCH] river-ctl patch @@ -15,8 +15,8 @@ fix bug dwl.c | 20 +- dwlctl.c | 132 +++++ protocols/river-control-unstable-v1.xml | 85 +++ - river-control.h | 746 ++++++++++++++++++++++++ - 7 files changed, 1026 insertions(+), 16 deletions(-) + river-control.h | 656 ++++++++++++++++++++++++ + 7 files changed, 936 insertions(+), 16 deletions(-) create mode 100644 dwlctl.c create mode 100644 protocols/river-control-unstable-v1.xml create mode 100644 river-control.h @@ -450,10 +450,10 @@ index 0000000..aa5fc4d + diff --git a/river-control.h b/river-control.h new file mode 100644 -index 0000000..0792dbd +index 0000000..42a5067 --- /dev/null +++ b/river-control.h -@@ -0,0 +1,746 @@ +@@ -0,0 +1,656 @@ +#include "river-control-unstable-v1-private-protocol.c" +#include "river-control-unstable-v1-protocol.h" +#ifdef KEYS_USED @@ -540,89 +540,6 @@ index 0000000..0792dbd + {WLR_MODIFIER_MOD2,"mod2"}, + {WLR_MODIFIER_MOD5,"mod5"}, +}; -+#define STR(a) \ -+ { XKB_KEY_##a, #a } -+struct Keysym_str_pair Keysym_str_pair_list[] = { -+ STR(1), -+ STR(2), -+ STR(3), -+ STR(4), -+ STR(5), -+ STR(6), -+ STR(7), -+ STR(8), -+ STR(9), -+ STR(0), -+ STR(percent), -+ STR(asciicircum), -+ STR(ampersand), -+ STR(asterisk), -+ STR(parenleft), -+ STR(parenright), -+ STR(comma), -+ STR(period), -+ STR(less), -+ STR(greater), -+ STR(exclam), -+ STR(at), -+ STR(numbersign), -+ STR(dollar), -+ STR(percent), -+ STR(Return), -+ STR(Tab), -+ STR(q), -+ STR(w), -+ STR(e), -+ STR(r), -+ STR(t), -+ STR(y), -+ STR(u), -+ STR(i), -+ STR(o), -+ STR(p), -+ STR(a), -+ STR(s), -+ STR(d), -+ STR(f), -+ STR(g), -+ STR(h), -+ STR(j), -+ STR(k), -+ STR(l), -+ STR(z), -+ STR(x), -+ STR(c), -+ STR(v), -+ STR(b), -+ STR(n), -+ STR(m), -+ STR(Q), -+ STR(W), -+ STR(E), -+ STR(R), -+ STR(T), -+ STR(Y), -+ STR(U), -+ STR(I), -+ STR(O), -+ STR(P), -+ STR(A), -+ STR(S), -+ STR(D), -+ STR(F), -+ STR(G), -+ STR(H), -+ STR(J), -+ STR(K), -+ STR(L), -+ STR(Z), -+ STR(X), -+ STR(C), -+ STR(V), -+ STR(B), -+ STR(N), -+ STR(M), -+}; + +typedef enum { + ZRIVER_ARG_TYPE_NONE=0, @@ -843,7 +760,6 @@ index 0000000..0792dbd + struct wl_resource *resource, + const char *argument) { + struct zriver_arg_list_resource *args = wl_resource_get_user_data(resource); -+ const struct Keysym_str_pair *ks; + const struct Mod_str_pair *ms; + const struct Func_str_type_pair *fst; + bool arg_filter = false; @@ -987,13 +903,7 @@ index 0000000..0792dbd + } + } + } else if (args->argc == 2) { -+ for (ks = Keysym_str_pair_list; ks < END(Keysym_str_pair_list); ks++) { -+ if (strcmp(argument,ks->keysym_str) == 0) { -+ // printf("keysym %s picked\n",ks->keysym_str); -+ args->p.kl->key->keysym = ks->keysym; -+ break; -+ } -+ } ++ args->p.kl->key->keysym = xkb_keysym_from_name(argument,XKB_KEYSYM_NO_FLAGS); + } else if (args->argc == 3) { + for (fst = Func_str_type_pair_list; fst < END(Func_str_type_pair_list); fst++) { + if (strcmp(argument,fst->func_str) == 0) {