dwm

dynamic window manager

git clone https://9o.is/git/dwm.git

commit 0be9ada01efc9b588de5af0564e792315b32c6fe
parent 5587534f9bab8f70e323d9d68da9c3bacc3b5d24
Author: Jul <jul@9o.is>
Date:   Tue,  3 Feb 2026 03:31:11 -0500

remove original foregrounded feature

Diffstat:
Mconfig.def.h | 3---
Mconfig.h | 3---
Mdwm.c | 97++-----------------------------------------------------------------------------
3 files changed, 2 insertions(+), 101 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -38,8 +38,6 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */ -static const float fgw = .6, fgh = .6; - static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ @@ -90,7 +88,6 @@ static const Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_r, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|Mod4Mask, XK_space, toggleforegrounded, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, diff --git a/config.h b/config.h @@ -32,8 +32,6 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */ -static const float fgw = .8, fgh = .8; - static const Layout layouts[] = { /* symbol arrange function */ { "[]D", deck }, @@ -86,7 +84,6 @@ static const Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_space, setlayout, {0} }, - { MODKEY, XK_minus, toggleforegrounded, {0} }, { MODKEY|ShiftMask, XK_0, view, {.ui = ~0 } }, { MODKEY|Mod1Mask, XK_0, tag, {.ui = ~0 } }, NUMKEYS( XK_1, 0) diff --git a/dwm.c b/dwm.c @@ -96,10 +96,9 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isforegrounded; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; Client *next; Client *snext; - Client *tnext; Monitor *mon; Window win; }; @@ -132,7 +131,6 @@ struct Monitor { Client *clients; Client *sel; Client *stack; - Client *foregrounded; Monitor *next; Window barwin; const Layout *lt[2]; @@ -153,14 +151,12 @@ static void applyrules(Client *c); static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact); static void arrange(Monitor *m); static void arrangemon(Monitor *m); -static void arrangeforegrounded(Monitor *m); static void attach(Client *c); static void attachstack(Client *c); static void buttonpress(XEvent *e); static void checkotherwm(void); static void cleanup(void); static void cleanupmon(Monitor *mon); -static void clientforeground(Client *c); static void clientmessage(XEvent *e); static void configure(Client *c); static void configurenotify(XEvent *e); @@ -224,7 +220,6 @@ static void tag(const Arg *arg); //static void tagmon(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); -static void toggleforegrounded(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); @@ -442,21 +437,6 @@ attachstack(Client *c) } void -attachforegrounded (Client *c) -{ - c->tnext = c->mon->foregrounded; - c->mon->foregrounded = c; -} - -void -detachforegrounded (Client *c) -{ - Client **tc; - for (tc = &c->mon->foregrounded; *tc && *tc != c; tc = &(*tc)->tnext); - *tc = c->tnext; -} - -void buttonpress(XEvent *e) { unsigned int i, x, click, occ; @@ -996,13 +976,7 @@ focusstack(const Arg *arg) if (ISVISIBLE(i)) c = i; } - if (c && selmon->sel->isforegrounded) { - clientforeground(selmon->sel); - clientforeground(c); - focus(c); - arrangeforegrounded(selmon); - arrange(selmon); - } else if (c) { + if (c) { focus(c); restack(selmon); XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); @@ -1388,39 +1362,6 @@ nexttiled(Client *c) return c; } -Client * -nextforegrounded(Client *c) -{ - for (; c && (!c->isforegrounded || !ISVISIBLE(c)); c = c->tnext); - return c; -} - -void -arrangeforegrounded (Monitor *m) -{ - unsigned int n,i,x,y,w,h; - Client *c; - - for (n = 0, c = nextforegrounded(m->foregrounded); c; c = nextforegrounded(c->tnext), n++); - if (n == 0) - return; - - for (i = 0, c = nextforegrounded(m->foregrounded); c; c = nextforegrounded(c->tnext), i++){ - if (n == 1) { - x = m->mx + (m->mw - m->mw * fgw) / 2; - y = m->my + (m->mh - m->mh * fgh) / 2; - w = (m->mw * fgw) - (2 * (m->foregrounded->bw)); - h = (m->mh * fgh) - (2 * (m->foregrounded->bw)); - } else { - x = (n - 1 - i) * (m->mw / n); - y = m->my + (m->mh - m->mh * fgh) / 2; - w = (m->mw * (1 / (float)n)) - (2 * (m->foregrounded->bw)); - h = (m->mh * fgh) - (2 * (m->foregrounded->bw)); - } - resize(c, x, y, w, h, borderpx, 0); - } -} - void pop(Client *c) { @@ -1982,29 +1923,6 @@ togglebar(const Arg *arg) } void -clientforeground(Client *c) -{ - if (!c) - return; - if (c->isfullscreen) /* no support for fullscreen windows */ - return; - - c->isforegrounded || c->isfloating ? - detachforegrounded(c) : attachforegrounded(c); - - c->isforegrounded = c->isfloating = - !c->isfloating && !c->isforegrounded; -} - -void -toggleforegrounded(const Arg *arg) -{ - clientforeground(selmon->sel); - arrangeforegrounded(selmon); - arrange(selmon); -} - -void togglefloating(const Arg *arg) { if (!selmon->sel) @@ -2018,12 +1936,6 @@ togglefloating(const Arg *arg) selmon->sel->h - 2 * (borderpx - selmon->sel->bw), borderpx, 0); - if (selmon->sel->isforegrounded) { - selmon->sel->isforegrounded = 0; - detachforegrounded(selmon->sel); - arrangeforegrounded(selmon); - } - arrange(selmon); } @@ -2077,11 +1989,6 @@ unmanage(Client *c, int destroyed) detach(c); detachstack(c); - if (c->isforegrounded){ - detachforegrounded(c); - arrangeforegrounded(m); - } - if (!destroyed) { wc.border_width = c->oldbw; XGrabServer(dpy); /* avoid race conditions */