Merge branch 'main' into main

This commit is contained in:
MayOrMayNotBeACat 2025-07-29 16:12:08 +02:00
commit 161c62ae6c
7 changed files with 1505 additions and 1 deletions

View File

@ -46,7 +46,7 @@ If you target the unstable `main` branch, specify that in the `Download` link on
You may choose to include screenshots (hosted in your patch's subdirectory) in your `README.md`. The process is described [here](https://docs.codeberg.org/markdown/using-images/).
8. Use the Codeberg web interface to send a pull request to [dwl-patches] (NOT to [dwl])
9. WHEN YOUR PULL REQUEST IS APPROVED, your Codeberg account will also be granted commit access to [dwl-patches]. Once you have write access, you can make direct modifications/upates to your patches instead of pull requests.
9. WHEN YOUR PULL REQUEST IS APPROVED, your Codeberg account will also be granted commit access to [dwl-patches]. Once you have write access, you can make direct modifications/upates to your patches and you are free to create new patches rather than creating pull requests.
Individuals who have made known that they no longer intend to maintain their patches will have commit access to the [dwl-pathces] repository removed.

View File

@ -13,6 +13,7 @@ slstatus -s | dwl
* pixman
### Download
- [main 2025-07-29](/dwl/dwl-patches/raw/branch/main/patches/bar/bar.patch)
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.7.patch)
- [0.6](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.6.patch)

1266
patches/bar/bar.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
### Description
This patch allows you to configure window resizing more flexibly.
It introduces three options with the following possible values:
- warp_cursor:
```
0 - the mouse cursor remains in its original position at the start of the resize.
1 - the cursor is automatically warped to the selected corner before resizing begins.
```
- lock_cursor:
```
0 - the cursor can move freely during the resize.
1 - the cursor position is completely frozen for the entire duration of the resize.
```
- resize_corner:
```
0: top-left
1: top-right
2: bottom-left
3: bottom-right
4: selects the corner based on the current mouse quadrant
```
### Demos
All demos below use resize_corner = 4:
| no warp + no lock | warp + lock |
|-|-|
| ![demo-nowarp-nolock](https://github.com/mmistika/dwl-better-resize/blob/main/demo/demo-nowarp-nolock.gif?raw=true) | ![demo-warp-lock](https://github.com/mmistika/dwl-better-resize/blob/main/demo/demo-warp-lock.gif?raw=true) |
| no warp + lock | warp + no lock |
|-|-|
| ![demo-nowarp-lock](https://github.com/mmistika/dwl-better-resize/blob/main/demo/demo-nowarp-lock.gif?raw=true) | ![demo-warp-nolock](https://github.com/mmistika/dwl-better-resize/blob/main/demo/demo-warp-nolock.gif?raw=true) |
### Known Issues (warp + lock)
The combination of warp_cursor and lock_cursor is not recommended without outer gaps.
If the selected resize corner aligns exactly with a screen corner, the cursor gets locked there and cannot be moved outward, so resizing only works inward.
To resize outward, you must restart the resize operation with the cursor positioned somewhere away from the screen corner.
This happens because the locked cursor cannot move past the screen edge, and therefore cannot generate a non-zero delta to resize outward.
On multihead setups, if the resize corner is near another screen, the window may switch monitors upon completion of the resize.
### Download
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/better-resize/better-resize-0.7.patch)
### Authors
- [mmistika](https://codeberg.org/mmistika)

View File

@ -0,0 +1,107 @@
From f109808140cd6323b3a100663a10e048ae32e3a0 Mon Sep 17 00:00:00 2001
From: mmistika <mistikasoft@gmail.com>
Date: Thu, 17 Jul 2025 11:59:18 +0200
Subject: [PATCH] Add configurable window resize
Signed-off-by: mmistika <mistikasoft@gmail.com>
---
config.def.h | 12 ++++++++++++
dwl.c | 45 +++++++++++++++++++++++++++++++++++++--------
2 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/config.def.h b/config.def.h
index 22d2171..e404549 100644
--- a/config.def.h
+++ b/config.def.h
@@ -20,6 +20,18 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
/* logging */
static int log_level = WLR_ERROR;
+/* window resizing */
+/* resize_corner:
+ * 0: top-left
+ * 1: top-right
+ * 2: bottom-left
+ * 3: bottom-right
+ * 4: closest to the cursor
+ */
+static const int resize_corner = 4;
+static const int warp_cursor = 1; /* 1: warp to corner, 0: dont warp */
+static const int lock_cursor = 0; /* 1: lock cursor, 0: don't lock */
+
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */
diff --git a/dwl.c b/dwl.c
index c717c1d..aacd074 100644
--- a/dwl.c
+++ b/dwl.c
@@ -407,6 +407,7 @@ static KeyboardGroup *kb_group;
static unsigned int cursor_mode;
static Client *grabc;
static int grabcx, grabcy; /* client-relative */
+static int rzcorner;
static struct wlr_output_layout *output_layout;
static struct wlr_box sgeom;
@@ -1873,8 +1874,24 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
.width = grabc->geom.width, .height = grabc->geom.height}, 1);
return;
} else if (cursor_mode == CurResize) {
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
+ int cdx = (int)round(cursor->x) - grabcx;
+ int cdy = (int)round(cursor->y) - grabcy;
+
+ const struct wlr_box box = {
+ .x = grabc->geom.x + (rzcorner & 1 ? 0 : cdx),
+ .y = grabc->geom.y + (rzcorner & 2 ? 0 : cdy),
+ .width = grabc->geom.width + (rzcorner & 1 ? cdx : -cdx),
+ .height = grabc->geom.height + (rzcorner & 2 ? cdy : -cdy)
+ };
+ resize(grabc, box, 1);
+
+ if (!lock_cursor) {
+ grabcx += cdx;
+ grabcy += cdy;
+ } else {
+ wlr_cursor_warp_closest(cursor, NULL, grabcx, grabcy);
+ }
+
return;
}
@@ -1920,12 +1937,24 @@ moveresize(const Arg *arg)
wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
break;
case CurResize:
- /* Doesn't work for X11 output - the next absolute motion event
- * returns the cursor to where it started */
- wlr_cursor_warp_closest(cursor, NULL,
- grabc->geom.x + grabc->geom.width,
- grabc->geom.y + grabc->geom.height);
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
+ const char *cursors[] = { "nw-resize", "ne-resize", "sw-resize", "se-resize" };
+
+ rzcorner = resize_corner;
+ grabcx = (int)round(cursor->x);
+ grabcy = (int)round(cursor->y);
+
+ if (rzcorner == 4)
+ /* identify the closest corner index */
+ rzcorner = (grabcx - grabc->geom.x < grabc->geom.x + grabc->geom.width - grabcx ? 0 : 1)
+ + (grabcy - grabc->geom.y < grabc->geom.y + grabc->geom.height - grabcy ? 0 : 2);
+
+ if (warp_cursor) {
+ grabcx = rzcorner & 1 ? grabc->geom.x + grabc->geom.width : grabc->geom.x;
+ grabcy = rzcorner & 2 ? grabc->geom.y + grabc->geom.height : grabc->geom.y;
+ wlr_cursor_warp_closest(cursor, NULL, grabcx, grabcy);
+ }
+
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, cursors[rzcorner]);
break;
}
}
--
2.50.1

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