dwl-patches overhaul

Eliminated wiki.
Individual patches have a README.md explanation in their own subdirectory.
Simplified submission of new patches and maintenance of existing patches.
Instructions page (README.md autodisplayed) is now at https://codeberg.org/dwl/dwl-patches/
This commit is contained in:
A Frederick Christensen
2024-04-24 20:20:07 -05:00
parent d6b051f5b8
commit 9c5d5d85f3
183 changed files with 1434 additions and 4 deletions
+23
View File
@@ -0,0 +1,23 @@
### Description
This patch allows you to add keybindings to the lockscreen.
```c
static const Key lockedkeys[] = {
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
/* modifier key function argument */
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};
```
### Download
- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.5/lockedkeys)
- [2024-04-11](https://codeberg.org/dwl/dwl-patches/raw/commit/fc4146f3068dcd46035a2a11fe9d6109a97ae6d6/lockedkeys/lockedkeys.patch)
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/commit/2a6560c167e5c9afc5598ac5431d23d90de8846c/lockedkeys/lockedkeys.patch)
### Authors
- [wochap](https://codeberg.org/wochap)
+79
View File
@@ -0,0 +1,79 @@
From 70dc03a3817b8fd933244c2db1bb849d9626b12b Mon Sep 17 00:00:00 2001
From: wochap <gean.marroquin@gmail.com>
Date: Thu, 11 Apr 2024 13:16:40 -0500
Subject: [PATCH] allow to add keybindings in lockscreen
---
config.def.h | 11 +++++++++++
dwl.c | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/config.def.h b/config.def.h
index 8847e58..0d4a4f8 100644
--- a/config.def.h
+++ b/config.def.h
@@ -164,6 +164,17 @@ static const Key keys[] = {
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};
+static const Key lockedkeys[] = {
+ /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
+ /* modifier key function argument */
+
+ /* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
+ { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
+#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
+ CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
+ CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
+};
+
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
diff --git a/dwl.c b/dwl.c
index bf763df..db4bb2b 100644
--- a/dwl.c
+++ b/dwl.c
@@ -287,6 +287,7 @@ static void handlesig(int signo);
static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym);
+static int lockedkeybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data);
static void keypressmod(struct wl_listener *listener, void *data);
static int keyrepeat(void *data);
@@ -1446,6 +1447,21 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
return 0;
}
+int
+lockedkeybinding(uint32_t mods, xkb_keysym_t sym)
+{
+ int handled = 0;
+ const Key *k;
+ for (k = lockedkeys; k < END(lockedkeys); k++) {
+ if (CLEANMASK(mods) == CLEANMASK(k->mod) &&
+ sym == k->keysym && k->func) {
+ k->func(&k->arg);
+ handled = 1;
+ }
+ }
+ return handled;
+}
+
void
keypress(struct wl_listener *listener, void *data)
{
@@ -1473,6 +1489,10 @@ keypress(struct wl_listener *listener, void *data)
handled = keybinding(mods, syms[i]) || handled;
}
+ if (locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED)
+ for (i = 0; i < nsyms; i++)
+ handled = lockedkeybinding(mods, syms[i]) || handled;
+
if (handled && group->wlr_group->keyboard.repeat_info.delay > 0) {
group->mods = mods;
group->keysyms = syms;
--
2.43.2