Add sizeposrules patch

This commit is contained in:
Gavin M 2024-03-15 17:28:23 -05:00
parent 0150cfebbc
commit e4dfe5a996

View File

@ -0,0 +1,63 @@
From cba6afd178d062ce182e548a3b327ac9f8d0a116 Mon Sep 17 00:00:00 2001
From: Gavin M <github@gavinm.us>
Date: Fri, 15 Mar 2024 17:27:20 -0500
Subject: [PATCH] Added sizeposrules
---
config.def.h | 6 +++---
dwl.c | 13 +++++++++++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index 9009517..3f886d0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -21,11 +21,11 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
static int log_level = WLR_ERROR;
static const Rule rules[] = {
- /* app_id title tags mask isfloating monitor */
+ /* app_id title tags mask isfloating x x_is_opp y y_is_opp width height monitor */
/* examples:
- { "Gimp", NULL, 0, 1, -1 },
+ { "Gimp", NULL, 0, 1, -1,-1, -1,-1, -1, -1, -1 },
*/
- { "firefox", NULL, 1 << 8, 0, -1 },
+ { "firefox", NULL, 1 << 8, 0, -1,-1, -1,-1, -1, -1, -1 },
};
/* layout(s) */
diff --git a/dwl.c b/dwl.c
index 5867b0c..7b12a16 100644
--- a/dwl.c
+++ b/dwl.c
@@ -227,6 +227,7 @@ typedef struct {
const char *title;
uint32_t tags;
int isfloating;
+ int x, x_is_opp, y, y_is_opp, width, height;
int monitor;
} Rule;
@@ -468,6 +469,18 @@ applyrules(Client *c)
if (r->monitor == i++)
mon = m;
}
+ if (r->x != -1) {
+ c->geom.x = !r->x_is_opp ? r->x : mon->m.width - r->x - (r->width != -1 ? r->width : 0);
+ }
+ if (r->y != -1) {
+ c->geom.y = !r->y_is_opp ? r->y : mon->m.height - r->y - (r->height != -1 ? r->height : 0);
+ }
+ if (r->width != -1) {
+ c->geom.width = r->width;
+ }
+ if (r->height != -1) {
+ c->geom.height = r->height;
+ }
}
}
setmon(c, mon, newtags);
--
2.44.0