removed unwanted patches

This commit is contained in:
Bryson Steck 2022-11-12 17:54:15 -07:00
parent 89ea6276f5
commit 4da4ae80e4
4 changed files with 21 additions and 234 deletions

View file

@ -6,13 +6,6 @@ static const unsigned int gappx = 6; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
/* Display modes of the tab bar: never shown, always shown, shown only in */
/* monocle mode in the presence of several windows. */
/* Modes after showtab_nmodes are disabled. */
enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always};
static const int showtab = showtab_auto; /* Default tab bar show mode */
static const int toptab = False; /* False means bottom tab bar */
static const char *fonts[] = { "monospace:size=10" }; static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10"; static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222"; static const char col_gray1[] = "#222222";
@ -50,7 +43,6 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */ { "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */ { "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle }, { "[M]", monocle },
{ "|||", col },
}; };
/* key definitions */ /* key definitions */
@ -74,7 +66,6 @@ static Key keys[] = {
{ MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_w, tabmode, {-1} },
{ MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_i, incnmaster, {.i = +1 } },
@ -87,7 +78,6 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} }, { MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY, XK_0, view, {.ui = ~0 } },
@ -123,6 +113,5 @@ static Button buttons[] = {
{ ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} },
{ ClkTabBar, 0, Button1, focuswin, {0} },
}; };

View file

@ -6,6 +6,7 @@ static const unsigned int gappx = 8; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const int swallowfloating = 0;
static const char *fonts[] = { "JetBrains Mono NF:style=medium:size=11" }; static const char *fonts[] = { "JetBrains Mono NF:style=medium:size=11" };
static const char dmenufont[] = "JetBrains Mono NF:stlye=medium:size=11"; static const char dmenufont[] = "JetBrains Mono NF:stlye=medium:size=11";
// gruvbox // gruvbox
@ -27,7 +28,7 @@ static const char *colors[][3] = {
}; };
/* tagging */ /* tagging */
static const char *tags[] = { "!", "@", "#", "$", "%", "^", "*", "(" }; static const char *tags[] = { "!", "@", "#", "$", "%", "^", "&", "*", "(" };
static const Rule rules[] = { static const Rule rules[] = {
/* xprop(1): /* xprop(1):
@ -56,7 +57,6 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */ { "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */ { "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle }, { "[M]", monocle },
{ "|||", col },
}; };
/* key definitions */ /* key definitions */
@ -111,7 +111,6 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} }, { MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY, XK_0, view, {.ui = ~0 } },

33
dwm.1
View file

@ -20,22 +20,14 @@ layout applied.
Windows are grouped by tags. Each window can be tagged with one or multiple Windows are grouped by tags. Each window can be tagged with one or multiple
tags. Selecting certain tags displays all windows with these tags. tags. Selecting certain tags displays all windows with these tags.
.P .P
Each screen contains two small status bars. Each screen contains a small status bar which displays all available tags, the
.P layout, the title of the focused window, and the text read from the root window
One bar displays all available tags, the layout, the title of the focused name property, if the screen is focused. A floating window is indicated with an
window, and the text read from the root window name property, if the screen is empty square and a maximised floating window is indicated with a filled square
focused. A floating window is indicated with an empty square and a maximised before the windows title. The selected tags are indicated with a different
floating window is indicated with a filled square before the windows title. The color. The tags of the focused window are indicated with a filled square in the
selected tags are indicated with a different color. The tags of the focused top left corner. The tags which are applied to one or more windows are
window are indicated with a filled square in the top left corner. The tags indicated with an empty square in the top left corner.
which are applied to one or more windows are indicated with an empty square in
the top left corner.
.P
Another bar contains a tab for each window of the current view and allows
navigation between windows, especially in the monocle mode. The different
display modes of this bar are described under the Mod1\-w Keybord command
section. When a single tag is selected, this tag is indicated in the left corner
of the tab bar.
.P .P
dwm draws a small border around windows to indicate the focus state. dwm draws a small border around windows to indicate the focus state.
.SH OPTIONS .SH OPTIONS
@ -52,8 +44,7 @@ command.
.TP .TP
.B Button1 .B Button1
click on a tag label to display all windows with that tag, click on the layout click on a tag label to display all windows with that tag, click on the layout
label toggles between tiled and floating layout, click on a window name in the label toggles between tiled and floating layout.
tab bar brings focus to that window.
.TP .TP
.B Button3 .B Button3
click on a tag label adds/removes all windows with that tag to/from the view. click on a tag label adds/removes all windows with that tag to/from the view.
@ -119,12 +110,6 @@ Increase master area size.
.B Mod1\-h .B Mod1\-h
Decrease master area size. Decrease master area size.
.TP .TP
.B Mod1\-w
Cycle over the tab bar display modes: never displayed, always displayed,
displayed only in monocle mode when the view contains more than one window (auto
mode). Some display modes can be disabled in the configuration, config.h. In
the default configuration only "never" and "auto" display modes are enabled.
.TP
.B Mod1\-Return .B Mod1\-Return
Zooms/cycles focused window to/from master area (tiled layouts only). Zooms/cycles focused window to/from master area (tiled layouts only).
.TP .TP

204
dwm.c
View file

@ -64,7 +64,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkTabBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
typedef union { typedef union {
@ -112,15 +112,12 @@ typedef struct {
void (*arrange)(Monitor *); void (*arrange)(Monitor *);
} Layout; } Layout;
#define MAXTABS 50
struct Monitor { struct Monitor {
char ltsymbol[16]; char ltsymbol[16];
float mfact; float mfact;
int nmaster; int nmaster;
int num; int num;
int by; /* bar geometry */ int by; /* bar geometry */
int ty; /* tab bar geometry */
int mx, my, mw, mh; /* screen size */ int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */ int wx, wy, ww, wh; /* window area */
int gappx; /* gaps between windows */ int gappx; /* gaps between windows */
@ -129,15 +126,11 @@ struct Monitor {
unsigned int tagset[2]; unsigned int tagset[2];
int showbar; int showbar;
int topbar; int topbar;
int toptab;
Client *clients; Client *clients;
Client *sel; Client *sel;
Client *stack; Client *stack;
Monitor *next; Monitor *next;
Window barwin; Window barwin;
Window tabwin;
int ntabs;
int tab_widths[MAXTABS];
const Layout *lt[2]; const Layout *lt[2];
}; };
@ -162,7 +155,6 @@ static void checkotherwm(void);
static void cleanup(void); static void cleanup(void);
static void cleanupmon(Monitor *mon); static void cleanupmon(Monitor *mon);
static void clientmessage(XEvent *e); static void clientmessage(XEvent *e);
static void col(Monitor *);
static void configure(Client *c); static void configure(Client *c);
static void configurenotify(XEvent *e); static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e); static void configurerequest(XEvent *e);
@ -175,8 +167,6 @@ static void drawbar(Monitor *m);
static void drawbars(void); static void drawbars(void);
static void enternotify(XEvent *e); static void enternotify(XEvent *e);
static void expose(XEvent *e); static void expose(XEvent *e);
static void drawtab(Monitor *m);
static void drawtabs(void);
static void focus(Client *c); static void focus(Client *c);
static void focusin(XEvent *e); static void focusin(XEvent *e);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
@ -254,7 +244,6 @@ static char stext[256];
static int screen; static int screen;
static int sw, sh; /* X display screen geometry width, height */ static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */ static int bh, blw = 0; /* bar geometry */
static int th = 0; /* tab bar geometry */
static int lrpad; /* sum of left and right padding for text */ static int lrpad; /* sum of left and right padding for text */
static int (*xerrorxlib)(Display *, XErrorEvent *); static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0; static unsigned int numlockmask = 0;
@ -412,9 +401,8 @@ arrange(Monitor *m)
} }
void void
arrangemon(Monitor *m) { arrangemon(Monitor *m)
updatebarpos(m); {
XMoveResizeWindow(dpy, m->tabwin, m->wx, m->ty, m->ww, th);
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
if (m->lt[m->sellt]->arrange) if (m->lt[m->sellt]->arrange)
m->lt[m->sellt]->arrange(m); m->lt[m->sellt]->arrange(m);
@ -470,24 +458,7 @@ buttonpress(XEvent *e)
click = ClkStatusText; click = ClkStatusText;
else else
click = ClkWinTitle; click = ClkWinTitle;
} } else if ((c = wintoclient(ev->window))) {
if(ev->window == selmon->tabwin) {
i = 0; x = 0;
for(c = selmon->clients; c; c = c->next){
if(!ISVISIBLE(c)) continue;
x += selmon->tab_widths[i];
if (ev->x > x)
++i;
else
break;
if(i >= m->ntabs) break;
}
if(c) {
click = ClkTabBar;
arg.ui = i;
}
}
else if((c = wintoclient(ev->window))) {
focus(c); focus(c);
restack(selmon); restack(selmon);
XAllowEvents(dpy, ReplayPointer, CurrentTime); XAllowEvents(dpy, ReplayPointer, CurrentTime);
@ -495,9 +466,8 @@ buttonpress(XEvent *e)
} }
for (i = 0; i < LENGTH(buttons); i++) for (i = 0; i < LENGTH(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)){ && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
buttons[i].func(((click == ClkTagBar || click == ClkTabBar) && buttons[i].arg.i == 0) ? &arg : &buttons[i].arg); buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
}
} }
void void
@ -552,8 +522,6 @@ cleanupmon(Monitor *mon)
} }
XUnmapWindow(dpy, mon->barwin); XUnmapWindow(dpy, mon->barwin);
XDestroyWindow(dpy, mon->barwin); XDestroyWindow(dpy, mon->barwin);
XUnmapWindow(dpy, mon->tabwin);
XDestroyWindow(dpy, mon->tabwin);
free(mon); free(mon);
} }
@ -804,105 +772,6 @@ drawbars(void)
drawbar(m); drawbar(m);
} }
void
drawtabs(void) {
Monitor *m;
for(m = mons; m; m = m->next)
drawtab(m);
}
static int
cmpint(const void *p1, const void *p2) {
/* The actual arguments to this function are "pointers to
pointers to char", but strcmp(3) arguments are "pointers
to char", hence the following cast plus dereference */
return *((int*) p1) > * (int*) p2;
}
void
drawtab(Monitor *m) {
Client *c;
int i;
int itag = -1;
char view_info[50];
int view_info_w = 0;
int sorted_label_widths[MAXTABS];
int tot_width;
int maxsize = bh;
int x = 0;
int w = 0;
//view_info: indicate the tag which is displayed in the view
for(i = 0; i < LENGTH(tags); ++i){
if((selmon->tagset[selmon->seltags] >> i) & 1) {
if(itag >=0){ //more than one tag selected
itag = -1;
break;
}
itag = i;
}
}
if(0 <= itag && itag < LENGTH(tags)){
snprintf(view_info, sizeof view_info, "[%s]", tags[itag]);
} else {
strncpy(view_info, "[...]", sizeof view_info);
}
view_info[sizeof(view_info) - 1 ] = 0;
view_info_w = TEXTW(view_info);
tot_width = view_info_w;
/* Calculates number of labels and their width */
m->ntabs = 0;
for(c = m->clients; c; c = c->next){
if(!ISVISIBLE(c)) continue;
m->tab_widths[m->ntabs] = TEXTW(c->name);
tot_width += m->tab_widths[m->ntabs];
++m->ntabs;
if(m->ntabs >= MAXTABS) break;
}
if(tot_width > m->ww){ //not enough space to display the labels, they need to be truncated
memcpy(sorted_label_widths, m->tab_widths, sizeof(int) * m->ntabs);
qsort(sorted_label_widths, m->ntabs, sizeof(int), cmpint);
tot_width = view_info_w;
for(i = 0; i < m->ntabs; ++i){
if(tot_width + (m->ntabs - i) * sorted_label_widths[i] > m->ww)
break;
tot_width += sorted_label_widths[i];
}
maxsize = (m->ww - tot_width) / (m->ntabs - i);
} else{
maxsize = m->ww;
}
i = 0;
for(c = m->clients; c; c = c->next){
if(!ISVISIBLE(c)) continue;
if(i >= m->ntabs) break;
if(m->tab_widths[i] > maxsize) m->tab_widths[i] = maxsize;
w = m->tab_widths[i];
drw_setscheme(drw, scheme[(c == m->sel) ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, th, 0, c->name, 0);
x += w;
++i;
}
drw_setscheme(drw, scheme[SchemeNorm]);
/* cleans interspace between window names and current viewed tag label */
w = m->ww - view_info_w - x;
drw_text(drw, x, 0, w, th, 0, "", 0);
/* view info */
x += w;
w = view_info_w;
drw_text(drw, x, 0, w, th, 0, view_info, 0);
drw_map(drw, m->tabwin, 0, 0, m->ww, th);
}
void void
enternotify(XEvent *e) enternotify(XEvent *e)
{ {
@ -928,10 +797,8 @@ expose(XEvent *e)
Monitor *m; Monitor *m;
XExposeEvent *ev = &e->xexpose; XExposeEvent *ev = &e->xexpose;
if(ev->count == 0 && (m = wintomon(ev->window))){ if (ev->count == 0 && (m = wintomon(ev->window)))
drawbar(m); drawbar(m);
drawtab(m);
}
} }
void void
@ -957,7 +824,6 @@ focus(Client *c)
} }
selmon->sel = c; selmon->sel = c;
drawbars(); drawbars();
drawtabs();
} }
/* there are some broken focus acquiring clients needing extra handling */ /* there are some broken focus acquiring clients needing extra handling */
@ -1391,14 +1257,12 @@ propertynotify(XEvent *e)
case XA_WM_HINTS: case XA_WM_HINTS:
updatewmhints(c); updatewmhints(c);
drawbars(); drawbars();
drawtabs();
break; break;
} }
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
updatetitle(c); updatetitle(c);
if (c == c->mon->sel) if (c == c->mon->sel)
drawbar(c->mon); drawbar(c->mon);
drawtab(c->mon);
} }
if (ev->atom == netatom[NetWMWindowType]) if (ev->atom == netatom[NetWMWindowType])
updatewindowtype(c); updatewindowtype(c);
@ -1513,7 +1377,6 @@ restack(Monitor *m)
XWindowChanges wc; XWindowChanges wc;
drawbar(m); drawbar(m);
drawtab(m);
if (!m->sel) if (!m->sel)
return; return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange) if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
@ -1718,7 +1581,6 @@ setup(void)
die("no fonts could be loaded."); die("no fonts could be loaded.");
lrpad = drw->fonts->h; lrpad = drw->fonts->h;
bh = drw->fonts->h + 2; bh = drw->fonts->h + 2;
th = bh;
updategeom(); updategeom();
/* init atoms */ /* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False); utf8string = XInternAtom(dpy, "UTF8_STRING", False);
@ -1843,32 +1705,6 @@ tagmon(const Arg *arg)
sendmon(selmon->sel, dirtomon(arg->i)); sendmon(selmon->sel, dirtomon(arg->i));
} }
void
col(Monitor *m)
{
unsigned int i, n, h, w, x, y, mw;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0;
else
mw = m->ww;
for (i = x = y = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
w = (mw - x) / (MIN(n, m->nmaster) - i);
resize(c, x + m->wx, m->wy, w - (2 * c->bw), m->wh - (2 * c->bw), 0);
x += WIDTH(c);
} else {
h = (m->wh - y) / (n - i);
resize(c, x + m->wx, m->wy + y, m->ww - x - (2 * c->bw), h - (2 * c->bw), 0);
y += HEIGHT(c);
}
}
void void
tile(Monitor *m) tile(Monitor *m)
{ {
@ -2015,11 +1851,6 @@ updatebars(void)
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->barwin); XMapRaised(dpy, m->barwin);
m->tabwin = XCreateWindow(dpy, root, m->wx, m->ty, m->ww, th, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->tabwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->tabwin);
XSetClassHint(dpy, m->barwin, &ch); XSetClassHint(dpy, m->barwin, &ch);
} }
} }
@ -2027,32 +1858,15 @@ updatebars(void)
void void
updatebarpos(Monitor *m) updatebarpos(Monitor *m)
{ {
Client *c;
int nvis = 0;
m->wy = m->my; m->wy = m->my;
m->wh = m->mh; m->wh = m->mh;
if (m->showbar) { if (m->showbar) {
m->wh -= bh; m->wh -= bh;
m->by = m->topbar ? m->wy : m->wy + m->wh; m->by = m->topbar ? m->wy : m->wy + m->wh;
if ( m->topbar ) m->wy = m->topbar ? m->wy + bh : m->wy;
m->wy += bh;
} else { } else {
m->by = -bh; m->by = -bh;
} }
for(c = m->clients; c; c = c->next) {
if(ISVISIBLE(c)) ++nvis;
}
if((nvis > 1) && (m->lt[m->sellt]->arrange == monocle)) {
m->wh -= th;
m->ty = m->toptab ? m->wy : m->wy + m->wh;
if ( m->toptab )
m->wy += th;
} else {
m->ty = -th;
}
} }
void void
@ -2290,7 +2104,7 @@ wintomon(Window w)
if (w == root && getrootptr(&x, &y)) if (w == root && getrootptr(&x, &y))
return recttomon(x, y, 1, 1); return recttomon(x, y, 1, 1);
for (m = mons; m; m = m->next) for (m = mons; m; m = m->next)
if (w == m->barwin || w == m->tabwin) if (w == m->barwin)
return m; return m;
if ((c = wintoclient(w))) if ((c = wintoclient(w)))
return c->mon; return c->mon;