update center-terminal

This commit is contained in:
Guido Cella 2025-06-14 23:14:48 +02:00
parent 938cd817a4
commit 927ed93711

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])) + if (!strcasecmp(appid, termcmd[0]))
+ c->centered = true; + c->centered = true;
+
c->isfloating |= client_is_float_type(c);
setmon(c, mon, newtags); setmon(c, mon, newtags);
} }
@@ -2730,6 +2738,11 @@ tile(Monitor *m)
@@ -2720,6 +2727,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