commit 80cf33e95d40d867c24b52038c5e1e81f7438012
parent d64b74da3da7f22d48417104947721397b3cd8a8
Author: wh1tepearl <wh1tepearl@gmail.com>
Date: Sun, 29 Mar 2026 13:01:24 +0100
bug fixes and make floating the default layout
Diffstat:
5 files changed, 73 insertions(+), 63 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -80,12 +80,12 @@ static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
#if LOCK_MOVE_RESIZE_REFRESH_RATE
-static const int refreshrate = 120; /* refresh rate (per second) for client move/resize, set it to your monitor refresh rate or double of that*/
+static const int refreshrate = 360; /* refresh rate (per second) for client move/resize, set it to your monitor refresh rate or double of that*/
#endif //LOCK_MOVE_RESIZE_REFRESH_RATE
static const Layout layouts[] = {
/* symbol arrange function */
+ { "><>", NULL }, /* no layout function means floating behavior */
{ "[]=", tile }, /* first entry is default */
- { "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
diff --git a/modules/directionalfocus/directionalfocus.c b/modules/directionalfocus/directionalfocus.c
@@ -59,38 +59,38 @@ focusdir(const Arg *arg)
break;
}
- client_score = axial + (lateral * lateral) / (axial + 1);
+ client_score = axial + (unsigned int)((long)lateral * lateral) / (axial + 1);
} else
#endif
{
int dist;
int dirweight = 20;
switch (arg->i) {
- case 0:
- dist = s->x - c->x - c->w;
- client_score =
- dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
- abs(s->y - c->y);
- break;
- case 1:
- dist = c->x - s->x - s->w;
- client_score =
- dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
- abs(c->y - s->y);
- break;
- case 2:
- dist = s->y - c->y - c->h;
- client_score =
- dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
- abs(s->x - c->x);
- break;
- default:
- case 3:
- dist = c->y - s->y - s->h;
- client_score =
- dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
- abs(c->x - s->x);
- break;
+ case 0:
+ dist = s->x - c->x - c->w;
+ client_score =
+ dirweight * abs(dist) +
+ abs(s->y - c->y);
+ break;
+ case 1:
+ dist = c->x - s->x - s->w;
+ client_score =
+ dirweight * abs(dist) +
+ abs(c->y - s->y);
+ break;
+ case 2:
+ dist = s->y - c->y - c->h;
+ client_score =
+ dirweight * abs(dist) +
+ abs(s->x - c->x);
+ break;
+ default:
+ case 3:
+ dist = c->y - s->y - s->h;
+ client_score =
+ dirweight * abs(dist) +
+ abs(c->x - s->x);
+ break;
}
}
diff --git a/modules/etf/etf.c b/modules/etf/etf.c
@@ -4,12 +4,9 @@ enhancedtogglefloating(const Arg *arg)
{
if (!selmon->sel || selmon->sel->isfullscreen)
return;
-
Client *c = selmon->sel;
- int prev = selmon->sellt;
-
+ const Layout *prevlayout = selmon->lt[selmon->sellt];
c->isfloating = !c->isfloating;
-
if (c->isfloating) {
int w = c->sfw > 0 ? c->sfw : c->w;
int h = c->sfh > 0 ? c->sfh : c->h;
@@ -18,15 +15,27 @@ enhancedtogglefloating(const Arg *arg)
c->mon->wy + (c->mon->wh - h) / 2,
w, h, 0);
} else {
- selmon->sellt = 0;
- arrange(selmon);
- selmon->sellt = prev;
+ int tiled_sellt = -1;
+ for (int i = 0; i < LENGTH(layouts); i++) {
+ if (selmon->lt[i]->arrange != NULL) {
+ tiled_sellt = i;
+ break;
+ }
+ }
+ if (tiled_sellt != -1) {
+ selmon->sellt = tiled_sellt;
+ arrange(selmon);
+ }
+ for (int i = 0; i < LENGTH(layouts); i++) {
+ if (selmon->lt[i] == prevlayout) {
+ selmon->sellt = i;
+ break;
+ }
+ }
}
-
arrange(selmon);
-
#if WARP_TO_CLIENT && WARP_TO_CENTER_OF_WINDOW_AFFECTED_BY_ENHANCED_TOGGLE_FLOATING
- warptoclient(selmon->sel); // larptoclient(selmon->sel);
+ warptoclient(selmon->sel);
#endif
}
#else
@@ -35,26 +44,20 @@ enhancedtogglefloating(const Arg *arg)
{
if (!selmon->sel || selmon->sel->isfullscreen)
return;
-
Client *c = selmon->sel;
-
const Layout *prevlayout = selmon->lt[selmon->sellt];
-
c->isfloating = !c->isfloating;
-
if (c->isfloating) {
int w = c->sfw > 0 ? c->sfw : c->w;
int h = c->sfh > 0 ? c->sfh : c->h;
-
if (!c->wasmanuallyedited) {
- resize(c,
- c->mon->wx + (c->mon->ww - w) / 2,
- c->mon->wy + (c->mon->wh - h) / 2,
- w, h, 0);
+ resize(c,
+ c->mon->wx + (c->mon->ww - w) / 2,
+ c->mon->wy + (c->mon->wh - h) / 2,
+ w, h, 0);
} else {
resize(c, c->sfx, c->sfy, w, h, 0);
}
-
c->sfx = c->x; c->sfy = c->y;
c->sfw = c->w; c->sfh = c->h;
} else {
@@ -62,10 +65,17 @@ enhancedtogglefloating(const Arg *arg)
c->sfy = c->y;
c->sfw = c->w;
c->sfh = c->h;
-
- selmon->sellt = 0;
- arrange(selmon);
-
+ int tiled_sellt = -1;
+ for (int i = 0; i < LENGTH(layouts); i++) {
+ if (selmon->lt[i]->arrange != NULL) {
+ tiled_sellt = i;
+ break;
+ }
+ }
+ if (tiled_sellt != -1) {
+ selmon->sellt = tiled_sellt;
+ arrange(selmon);
+ }
for (int i = 0; i < LENGTH(layouts); i++) {
if (selmon->lt[i] == prevlayout) {
selmon->sellt = i;
@@ -73,11 +83,9 @@ enhancedtogglefloating(const Arg *arg)
}
}
}
-
arrange(selmon);
-
#if WARP_TO_CLIENT && WARP_TO_CENTER_OF_WINDOW_AFFECTED_BY_ENHANCED_TOGGLE_FLOATING
- warptoclient(selmon->sel); // larptoclient(selmon->sel);
+ warptoclient(selmon->sel);
#endif
}
#endif
diff --git a/modules/infinitetags/infinitetags.c b/modules/infinitetags/infinitetags.c
@@ -149,6 +149,8 @@ restore_canvas_positions(Monitor *m) {
for (c = m->clients; c; c = c->next) {
if (ISVISIBLE(c) && c->was_on_canvas) {
+ if (c->isfullscreen)
+ continue;
c->isfloating = 1;
int target_x = c->saved_cx - m->canvas[tagidx].cx;
diff --git a/modules/warptoclient/warptoclient.c b/modules/warptoclient/warptoclient.c
@@ -1,15 +1,15 @@
void
warptoclient(Client *c)
{
- int x, y;
+ int x, y;
- if (!c) {
- XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2);
- return;
- }
+ if (!c) {
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2);
+ return;
+ }
- x = c->x + c->w / 2;
- y = c->y + c->h / 2;
+ x = c->x + WIDTH(c) / 2;
+ y = c->y + HEIGHT(c) / 2;
- XWarpPointer(dpy, None, root, 0, 0, 0, 0, x, y);
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, x, y);
}