Compare commits

...

2 Commits

Author SHA1 Message Date
Guido Cella
1d16e63d46 update alwayscenter 2025-06-14 23:15:32 +02:00
Guido Cella
927ed93711 update center-terminal 2025-06-14 23:14:48 +02:00
2 changed files with 22 additions and 20 deletions

View File

@ -1,29 +1,30 @@
From 6616470ef135019ef4c767003a66df76df45f53e Mon Sep 17 00:00:00 2001 From f43a49324c2ddd21100d6308d1adde9d894746e2 Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Wed, 5 Jun 2024 12:05:16 +0200 Date: Wed, 5 Jun 2024 12:05:16 +0200
Subject: [PATCH] center floating windows Subject: [PATCH] center floating windows
--- ---
dwl.c | 8 ++++++++ dwl.c | 9 +++++++++
1 file changed, 8 insertions(+) 1 file changed, 9 insertions(+)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 6f041a0..79ace52 100644 index 12f441e..c377c67 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -472,6 +472,10 @@ applyrules(Client *c) @@ -499,6 +499,11 @@ applyrules(Client *c)
}
} }
} }
+ if (mon) { + if (mon) {
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x; + c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y; + c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
+ } + }
+
c->isfloating |= client_is_float_type(c);
setmon(c, mon, newtags); setmon(c, mon, newtags);
} }
@@ -1787,6 +1792,10 @@ mapnotify(struct wl_listener *listener, void *data)
@@ -1677,6 +1681,10 @@ mapnotify(struct wl_listener *listener, void *data) * If there is no parent, apply rules */
* try to apply rules for them */
if ((p = client_get_parent(c))) { if ((p = client_get_parent(c))) {
c->isfloating = 1; c->isfloating = 1;
+ if (p->mon) { + if (p->mon) {
@ -34,5 +35,5 @@ index 6f041a0..79ace52 100644
} else { } else {
applyrules(c); applyrules(c);
-- --
2.45.1 2.49.0

View File

@ -1,4 +1,4 @@
From dfaafc1624438d2157cbb15b496e8177544491e0 Mon Sep 17 00:00:00 2001 From 340cc5ef90dfcc495bdad045f3f76ae07405cffd Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Tue, 6 Feb 2024 09:20:48 +0100 Date: Tue, 6 Feb 2024 09:20:48 +0100
Subject: [PATCH] add a keybinding to center the terminal Subject: [PATCH] add a keybinding to center the terminal
@ -10,8 +10,8 @@ This limits the width of long text making it easier to read, and avoids
covering the wallpaper more than necessary. covering the wallpaper more than necessary.
--- ---
config.def.h | 1 + config.def.h | 1 +
dwl.c | 19 +++++++++++++++++++ dwl.c | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+) 2 files changed, 21 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 22d2171..8229fcc 100644 index 22d2171..8229fcc 100644
@ -26,7 +26,7 @@ index 22d2171..8229fcc 100644
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index ad21e1b..b126b32 100644 index 12f441e..3b15748 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
@ -62,16 +62,17 @@ index ad21e1b..b126b32 100644
#ifdef XWAYLAND #ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data); static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data); static void associatex11(struct wl_listener *listener, void *data);
@@ -499,6 +504,8 @@ applyrules(Client *c) @@ -499,6 +504,9 @@ applyrules(Client *c)
} }
} }
}
+ if (!strcasecmp(appid, termcmd[0]))
+ c->centered = true;
setmon(c, mon, newtags);
}
@@ -2720,6 +2727,11 @@ tile(Monitor *m) + if (!strcasecmp(appid, termcmd[0]))
+ c->centered = true;
+
c->isfloating |= client_is_float_type(c);
setmon(c, mon, newtags);
}
@@ -2730,6 +2738,11 @@ tile(Monitor *m)
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue; continue;
if (i < m->nmaster) { if (i < m->nmaster) {
@ -83,7 +84,7 @@ index ad21e1b..b126b32 100644
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw, resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0); .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
my += c->geom.height; my += c->geom.height;
@@ -2732,6 +2744,13 @@ tile(Monitor *m) @@ -2742,6 +2755,13 @@ tile(Monitor *m)
} }
} }
@ -98,5 +99,5 @@ index ad21e1b..b126b32 100644
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {
-- --
2.47.1 2.49.0