Compare commits

...
2 Commits
Author SHA1 Message Date
Palanix 3940eaa6a4 Update dragmfact to v0.9 2026-09-25 18:25:18 +02:00
Palanix 2c342cc0b4 Update monitorconfig to 0.9 2026-09-25 18:21:11 +02:00
4 changed files with 156 additions and 0 deletions
+1
View File
@@ -3,6 +3,7 @@ Change mfact by dragging the mouse.
### Download
- [git branch](https://codeberg.org/Palanix/dwl/src/branch/dragmfact)
- [v0.9](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dragmfact/dragmfact-v0.9.patch)
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dragmfact/dragmfact-v0.7.patch)
- [v0.6](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dragmfact/dragmfact-v0.6.patch)
- [2024-02-16](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/dragmfact/dragmfact.patch)
+60
View File
@@ -0,0 +1,60 @@
From e0bec95eb6527dc5b87244ba025b28d2eaac94fe Mon Sep 17 00:00:00 2001
From: Palanix <palanixyt@gmail.com>
Date: Fri, 25 Mar 2022 23:45:10 +0100
Subject: [PATCH] Change mfact using Middle mouse
---
config.def.h | 2 +-
dwl.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 13c5322..ddce20b 100644
--- a/config.def.h
+++ b/config.def.h
@@ -167,7 +167,7 @@ static const Key keys[] = {
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
- { MODKEY, BTN_MIDDLE, togglefloating, {0} },
+ { MODKEY, BTN_MIDDLE, moveresize, {.ui = Curmfact} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};
diff --git a/dwl.c b/dwl.c
index 4cfd0fd..1eb98c2 100644
--- a/dwl.c
+++ b/dwl.c
@@ -86,7 +86,7 @@
#define LISTEN_STATIC(E, H) do { struct wl_listener *_l = ecalloc(1, sizeof(*_l)); _l->notify = (H); wl_signal_add((E), _l); } while (0)
/* enums */
-enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
+enum { CurNormal, CurPressed, CurMove, CurResize, Curmfact }; /* cursor */
enum { XDGShell, LayerShell, X11 }; /* client types */
enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrUnmanaged, LyrOverlay,
LyrIMPopup, LyrBlock, NUM_LAYERS }; /* scene layers */
@@ -2077,6 +2077,9 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
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);
return;
+ } else if (cursor_mode == Curmfact && time) {
+ selmon->mfact = (float) (cursor->x / selmon->m.width);
+ arrange(selmon);
}
/* If there's no client surface under the cursor, set the cursor image to a
@@ -2128,6 +2131,10 @@ moveresize(const Arg *arg)
grabc->geom.y + grabc->geom.height);
wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
break;
+ case Curmfact:
+ setfloating(grabc, 0);
+ selmon->mfact = (float) (cursor->x / selmon->m.width);
+ arrange(selmon);
}
}
--
2.55.0
+1
View File
@@ -4,6 +4,7 @@ Allows more monitor configuration in config.h
### Download
- [git branch](https://codeberg.org/Palanix/dwl/src/branch/monitorconfig)
- [wlroots-next-f4249db](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/monitorconfig/monitorconfig-wlroots-next-f4249db.patch)
- [0.9](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/monitorconfig/monitorconfig-0.9.patch)
- [0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/monitorconfig/monitorconfig-0.8.patch)
### Authors
@@ -0,0 +1,94 @@
From 55494409072aad907aea0c02c796d56a9e925459 Mon Sep 17 00:00:00 2001
From: Palanix <palanixyt@gmail.com>
Date: Mon, 4 Apr 2022 16:08:29 +0200
Subject: [PATCH] Updated patch now allowing setting x and y
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Leonardo Hernández Hernández <leohdz172@proton.me>
---
config.def.h | 12 ++++++++----
dwl.c | 25 +++++++++++++++++++------
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/config.def.h b/config.def.h
index 13c5322..2d1fcb5 100644
--- a/config.def.h
+++ b/config.def.h
@@ -41,10 +41,14 @@ static const Layout layouts[] = {
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
static const MonitorRule monrules[] = {
- /* name mfact nmaster scale layout rotate/reflect x y
- * example of a HiDPI laptop monitor:
- { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */
- { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ /* name mfact nmaster scale layout rotate/reflect x y resx resy rate mode adaptive*/
+ /* example of a HiDPI laptop monitor at 120Hz: { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000f, 1, 1}, */
+ /*
+ * mode let's the user decide on how dwl should implement the modes:
+ * -1 Sets a custom mode following the users choice
+ * All other number's set the mode at the index n, 0 is the standard mode; see wlr-randr
+ */
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0.0f, 0 ,1},
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
};
diff --git a/dwl.c b/dwl.c
index 4cfd0fd..755a826 100644
--- a/dwl.c
+++ b/dwl.c
@@ -235,6 +235,11 @@ typedef struct {
const Layout *lt;
enum wl_output_transform rr;
int x, y;
+ int resx;
+ int resy;
+ float rate;
+ int mode;
+ int adaptive;
} MonitorRule;
typedef struct {
@@ -1139,6 +1144,7 @@ createmon(struct wl_listener *listener, void *data)
/* This event is raised by the backend when a new output (aka a display or
* monitor) becomes available. */
struct wlr_output *wlr_output = data;
+ struct wlr_output_mode *mode = wl_container_of(wlr_output->modes.next, mode, link);
const MonitorRule *r;
size_t i;
struct wlr_output_state state;
@@ -1167,16 +1173,23 @@ createmon(struct wl_listener *listener, void *data)
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
wlr_output_state_set_scale(&state, r->scale);
wlr_output_state_set_transform(&state, r->rr);
+
+ wlr_output_state_set_adaptive_sync_enabled(&state, r->adaptive);
+
+ if(r->mode == -1)
+ wlr_output_state_set_custom_mode(&state, r->resx, r->resy,
+ (int) (r->rate > 0 ? r->rate * 1000 : 0));
+ else if (!wl_list_empty(&wlr_output->modes)) {
+ for (int j = 0; j < r->mode; j++) {
+ mode = wl_container_of(mode->link.next, mode, link);
+ }
+ wlr_output_state_set_mode(&state, mode);
+ }
+
break;
}
}
- /* The mode is a tuple of (width, height, refresh rate), and each
- * monitor supports only a specific set of modes. We just pick the
- * monitor's preferred mode; a more sophisticated compositor would let
- * the user configure it. */
- wlr_output_state_set_mode(&state, wlr_output_preferred_mode(wlr_output));
-
/* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
--
2.55.0