update alwayscenter and center-terminal

This commit is contained in:
Guido Cella 2024-02-06 09:21:22 +01:00
parent e2b487ee47
commit d9fe9d0fe2
2 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,4 @@
From 6f241273b58643396fd052027c8cde6f815376c8 Mon Sep 17 00:00:00 2001 From 95ac2fd73af8cee3ce3e556c254e60a2ca985515 Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Tue, 16 Jan 2024 18:14:50 +0100 Date: Tue, 16 Jan 2024 18:14:50 +0100
Subject: [PATCH] center floating windows Subject: [PATCH] center floating windows
@ -8,18 +8,18 @@ Subject: [PATCH] center floating windows
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index f25ac2f..9058ce2 100644 index 95ebee8..ac077e3 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -450,6 +450,8 @@ applyrules(Client *c) @@ -453,6 +453,8 @@ applyrules(Client *c)
} }
} }
} }
+ 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;
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
setmon(c, mon, newtags); setmon(c, mon, newtags);
} }
-- --
2.43.0 2.43.0

View File

@ -1,6 +1,6 @@
From 24710beb90ecd512f36510ffbd95b45076be5873 Mon Sep 17 00:00:00 2001 From 5646d7e7d933a2e7a667767c3fde89c91697c4ea Mon Sep 17 00:00:00 2001
From: Guido Cella <guido@guidocella.xyz> From: Guido Cella <guido@guidocella.xyz>
Date: Tue, 16 Jan 2024 18:49:59 +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
Add a keybinding that toggles centering the terminally horizontally when Add a keybinding that toggles centering the terminally horizontally when
@ -26,7 +26,7 @@ index a85ca27..2055df9 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 8ecdeb0..559c726 100644 index 002349a..4582413 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
@ -37,7 +37,7 @@ index 8ecdeb0..559c726 100644
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@@ -134,6 +135,7 @@ typedef struct { @@ -135,6 +136,7 @@ typedef struct {
unsigned int bw; unsigned int bw;
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen;
@ -45,7 +45,7 @@ index 8ecdeb0..559c726 100644
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@@ -318,6 +320,7 @@ static void startdrag(struct wl_listener *listener, void *data); @@ -319,6 +321,7 @@ static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg); static void tag(const Arg *arg);
static void tagmon(const Arg *arg); static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
@ -53,7 +53,7 @@ index 8ecdeb0..559c726 100644
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
@@ -389,6 +392,8 @@ static struct wlr_box sgeom; @@ -392,6 +395,8 @@ static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
@ -62,16 +62,16 @@ index 8ecdeb0..559c726 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);
@@ -455,6 +460,8 @@ applyrules(Client *c) @@ -457,6 +462,8 @@ applyrules(Client *c)
}
} }
} }
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
+ if (!strcasecmp(appid, termcmd[0])) + if (!strcasecmp(appid, termcmd[0]))
+ c->centered = true; + c->centered = true;
setmon(c, mon, newtags); setmon(c, mon, newtags);
} }
@@ -2509,6 +2516,11 @@ tile(Monitor *m) @@ -2519,6 +2526,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 +83,7 @@ index 8ecdeb0..559c726 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;
@@ -2521,6 +2533,13 @@ tile(Monitor *m) @@ -2531,6 +2543,13 @@ tile(Monitor *m)
} }
} }