Add disable-keybindings-on-fullscreen-toggle

This commit is contained in:
Shringe 2025-07-19 13:21:19 -05:00 committed by A Frederick Christensen
parent 07ad746a6f
commit 1b14ce7fc6
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,11 @@
### Description
This patch changes the default behavior of the [disable-keybindings-on-fullscreen](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/disable-keybindings-on-fullscreen) patch by only taking effect when you explicitly toggle the functionality.
You must apply that patch prior to applying this one.
### Download
- [git branch](https://github.com/Shringe/dwl/tree/disable-keybindings-on-fullscreen-toggle)
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/disable-keybindings-on-fullscreen-toggle/disable-keybindings-on-fullscreen-toggle-0.7.patch)
### Authors
- [Shringe](https://codeberg.org/Shringe)
- shringe_ at [dwl Discord](https://discord.gg/jJxZnrGPWN)

View File

@ -0,0 +1,71 @@
From 71809cee0e27f1b3620773e1745afed8023f71c9 Mon Sep 17 00:00:00 2001
From: Shringe <dashingkoso@gmail.com>
Date: Mon, 23 Jun 2025 18:50:40 -0500
Subject: [PATCH] Implemented functionality for patch
---
config.def.h | 1 +
dwl.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 22d2171..dda4ad0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -142,6 +142,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_G, togglefullscreenkeyinhibit, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
diff --git a/dwl.c b/dwl.c
index f11de4b..5deb9c7 100644
--- a/dwl.c
+++ b/dwl.c
@@ -341,6 +341,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
+static void togglefullscreenkeyinhibit(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data);
@@ -414,6 +415,8 @@ static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
+static int fullscreen_key_inhibit_enabled = 0;
+
#ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data);
@@ -1583,8 +1586,9 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
for (k = keys; k < END(keys); k++) {
if (CLEANMASK(mods) == CLEANMASK(k->mod)
&& sym == k->keysym && k->func) {
- if (c && c->isfullscreen) {
- if (k->func == togglefullscreen) {
+ if (fullscreen_key_inhibit_enabled
+ && c && c->isfullscreen) {
+ if (k->func == togglefullscreenkeyinhibit) {
k->func(&k->arg);
return 1;
}
@@ -2763,6 +2767,12 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen);
}
+void
+togglefullscreenkeyinhibit(const Arg *arg)
+{
+ fullscreen_key_inhibit_enabled = !fullscreen_key_inhibit_enabled;
+}
+
void
toggletag(const Arg *arg)
{
--
2.49.0