passthrough: rename passthru to passthrough

README.md: explain default keybind
This commit is contained in:
choc 2024-06-26 16:42:23 +08:00
parent 59d5b28396
commit f7f596b489
No known key found for this signature in database
2 changed files with 21 additions and 18 deletions

View File

@ -3,8 +3,11 @@ allows pausing keybind handling
also allows for bitcarrying-esque control of nested instances also allows for bitcarrying-esque control of nested instances
default keybind is Ctrl+Logo+Alt+Shift+Esc, can be customized in config.h
### Download ### Download
- [git branch](https://codeberg.org/notchoc/dwl/src/branch/passthrough) - [git branch](https://codeberg.org/notchoc/dwl/src/branch/passthrough)
- [2024-06-22](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/passthrough/passthrough.patch) - [2024-06-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/passthrough/passthrough.patch)
- [2024-06-22](https://codeberg.org/dwl/dwl-patches/raw/commit/3f44fb23d8cb6c7d700f41525dc00493e392083c/patches/passthrough/passthrough.patch)
### Authors ### Authors
- [notchoc](https://codeberg.org/notchoc) - [notchoc](https://codeberg.org/notchoc)

View File

@ -1,16 +1,16 @@
From 26dcd6a7aa8cb061a48c2233fe588f4426acb302 Mon Sep 17 00:00:00 2001 From cd67c8386b0188daa15348c1d0d99187a556e461 Mon Sep 17 00:00:00 2001
From: choc <notchoc@proton.me> From: choc <notchoc@proton.me>
Date: Mon, 2 Jan 2023 13:00:29 +0800 Date: Mon, 2 Jan 2023 13:00:29 +0800
Subject: [PATCH] passthrough: allow pausing keybind handling Subject: [PATCH] passthrough: allow pausing keybind handling
allows for bitcarrying-esque control of nested instances also allows for bitcarrying-esque control of nested instances
--- ---
config.def.h | 4 ++++ config.def.h | 4 ++++
dwl.c | 14 ++++++++++++++ dwl.c | 14 ++++++++++++++
2 files changed, 18 insertions(+) 2 files changed, 18 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index a784eb4..2913c82 100644 index 646a3d6..2d14e2a 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -20,6 +20,9 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca @@ -20,6 +20,9 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
@ -18,60 +18,60 @@ index a784eb4..2913c82 100644
static int log_level = WLR_ERROR; static int log_level = WLR_ERROR;
+/* passthrough */ +/* passthrough */
+static int allow_passthru = 0; +static int passthrough = 0;
+ +
static const Rule rules[] = { static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */ /* app_id title tags mask isfloating monitor */
/* examples: */ /* examples: */
@@ -154,6 +157,7 @@ static const Key keys[] = { @@ -156,6 +159,7 @@ static const Key keys[] = {
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6), TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7), TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8), TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
+ { WLR_MODIFIER_ALT|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT, XKB_KEY_Escape, togglepassthru, {0} }, + { WLR_MODIFIER_ALT|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT, XKB_KEY_Escape, togglepassthrough, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */ /* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index d48bf40..0f8cad0 100644 index 9fb50a7..a1c65b4 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -338,6 +338,7 @@ static void tagmon(const Arg *arg); @@ -339,6 +339,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
+static void togglepassthru(const Arg *arg); +static void togglepassthrough(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data); static void unlocksession(struct wl_listener *listener, void *data);
@@ -619,6 +620,11 @@ buttonpress(struct wl_listener *listener, void *data) @@ -620,6 +621,11 @@ buttonpress(struct wl_listener *listener, void *data)
for (b = buttons; b < END(buttons); b++) { for (b = buttons; b < END(buttons); b++) {
if (CLEANMASK(mods) == CLEANMASK(b->mod) && if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
event->button == b->button && b->func) { event->button == b->button && b->func) {
+ if (allow_passthru) { + if (passthrough) {
+ if (b->func != togglepassthru) continue; + if (b->func != togglepassthrough) continue;
+ b->func(&b->arg); + b->func(&b->arg);
+ break; + break;
+ } + }
b->func(&b->arg); b->func(&b->arg);
return; return;
} }
@@ -1506,6 +1512,8 @@ keybinding(uint32_t mods, xkb_keysym_t sym) @@ -1509,6 +1515,8 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
for (k = keys; k < END(keys); k++) { for (k = keys; k < END(keys); k++) {
if (CLEANMASK(mods) == CLEANMASK(k->mod) if (CLEANMASK(mods) == CLEANMASK(k->mod)
&& sym == k->keysym && k->func) { && sym == k->keysym && k->func) {
+ if (allow_passthru && k->func != togglepassthru) + if (passthrough && k->func != togglepassthrough)
+ continue; + continue;
k->func(&k->arg); k->func(&k->arg);
return 1; return 1;
} }
@@ -2675,6 +2683,12 @@ togglefullscreen(const Arg *arg) @@ -2677,6 +2685,12 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen); setfullscreen(sel, !sel->isfullscreen);
} }
+void +void
+togglepassthru(const Arg *arg) +togglepassthrough(const Arg *arg)
+{ +{
+ allow_passthru = !allow_passthru; + passthrough = !passthrough;
+} +}
+ +
void void