Compare commits

..

No commits in common. "bc86c745c44dc4420a879a6094594003622dae63" and "7f64fe2ae10a57b8150c93267a51e252db4b970a" have entirely different histories.

10 changed files with 253 additions and 416 deletions

View File

@ -26,16 +26,12 @@ static const char *colors[][3] = {
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan }, [SchemeSel] = { col_gray4, col_cyan, col_cyan },
[SchemeHid] = { col_cyan, col_gray1, col_cyan }, [SchemeHid] = { col_cyan, col_gray1, col_cyan },
[SchemeLay] = { col_cyan, "#00ff00", col_cyan },
[SchemeWf] = { col_cyan, "#00ffff", col_cyan },
}; };
static const unsigned int alphas[][3] = { static const unsigned int alphas[][3] = {
/* fg bg border*/ /* fg bg border*/
[SchemeNorm] = { OPAQUE, baralpha, borderalpha }, [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
[SchemeSel] = { OPAQUE, baralpha, borderalpha }, [SchemeSel] = { OPAQUE, baralpha, borderalpha },
[SchemeHid] = { OPAQUE, baralpha, borderalpha }, [SchemeHid] = { OPAQUE, baralpha, borderalpha },
[SchemeLay] = { OPAQUE, baralpha, borderalpha },
[SchemeWf] = { OPAQUE, baralpha, borderalpha },
}; };
static const char *const autostart[] = { static const char *const autostart[] = {
@ -62,20 +58,6 @@ static const unsigned int ulinestroke = 2; /* thickness / height of the underlin
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */ static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */ static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
static const char *tagsel[][2] = {
{ "#ffffff", "#ff0000" },
{ "#ffffff", "#ff7f00" },
{ "#000000", "#ffff00" },
{ "#000000", "#00ff00" },
{ "#ffffff", "#0000ff" },
{ "#ffffff", "#4b0082" },
{ "#ffffff", "#9400d3" },
{ "#000000", "#ffffff" },
{ "#ffffff", "#000000" },
};
static const unsigned int tagalpha[] = { OPAQUE, baralpha };
static const Rule rules[] = { static const Rule rules[] = {
/* xprop(1): /* xprop(1):
* WM_CLASS(STRING) = instance, class * WM_CLASS(STRING) = instance, class
@ -88,9 +70,6 @@ static const Rule rules[] = {
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */ { NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */
}; };
static const char topicon[128] = "\uf435";
/* icon to indicate always on top floating windows */
/* window following */ /* window following */
#define WFACTIVE '>' #define WFACTIVE '>'
#define WFINACTIVE 'v' #define WFINACTIVE 'v'
@ -107,7 +86,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 },
{ "[D]", deck },
}; };
/* key definitions */ /* key definitions */
@ -152,10 +130,8 @@ static const 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_r, 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|ShiftMask, XK_t, togglealwaysontop, {0} },
{ MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } }, { MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
{ MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } }, { MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
{ MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } }, { MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },

190
dwm.c
View File

@ -67,7 +67,7 @@
/* enums */ /* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel, SchemeHid, SchemeLay, SchemeWf }; /* color schemes */ enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck, enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */ NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */
@ -102,7 +102,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
int bw, oldbw; int bw, oldbw;
unsigned int tags; unsigned int tags;
int isfixed, isfloating, isalwaysontop, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen, isterminal, noswallow; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen, isterminal, noswallow;
pid_t pid; pid_t pid;
Client *next; Client *next;
Client *snext; Client *snext;
@ -187,7 +187,6 @@ 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);
static Monitor *createmon(void); static Monitor *createmon(void);
static void deck(Monitor *m);
static void destroynotify(XEvent *e); static void destroynotify(XEvent *e);
static void detach(Client *c); static void detach(Client *c);
static void detachstack(Client *c); static void detachstack(Client *c);
@ -263,7 +262,6 @@ static void togglefakefullscr(const Arg *arg);
static void togglefullscr(const Arg *arg); static void togglefullscr(const Arg *arg);
static void toggleextrabar(const Arg *arg); static void toggleextrabar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglealwaysontop(const Arg *arg);
static void togglefollow(const Arg *arg); static void togglefollow(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
@ -282,6 +280,9 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c); static void updatewindowtype(Client *c);
static void updatewmhints(Client *c); static void updatewmhints(Client *c);
static void view(const Arg *arg); static void view(const Arg *arg);
static void window_set_state(Display *dpy, Window win, long state);
static void window_map(Display *dpy, Client *c, int deiconify);
static void window_unmap(Display *dpy, Window win, Window root, int iconify);
static Client *wintoclient(Window w); static Client *wintoclient(Window w);
static Monitor *wintomon(Window w); static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee); static int xerror(Display *dpy, XErrorEvent *ee);
@ -333,7 +334,6 @@ static int restart = 0;
static int running = 1; static int running = 1;
static Cur *cursor[CurLast]; static Cur *cursor[CurLast];
static Clr **scheme; static Clr **scheme;
static Clr **tagscheme;
static Display *dpy; static Display *dpy;
static Drw *drw; static Drw *drw;
static Monitor *mons, *selmon; static Monitor *mons, *selmon;
@ -607,9 +607,15 @@ buttonpress(XEvent *e)
} }
if (ev->window == selmon->barwin) { if (ev->window == selmon->barwin) {
i = x = 0; i = x = 0;
do unsigned int occ = 0;
for(c = m->clients; c; c=c->next)
occ |= c->tags == TAGMASK ? 0 : c->tags;
do {
/* Do not reserve space for vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
x += TEXTW(tags[i]); x += TEXTW(tags[i]);
while (ev->x >= x && ++i < LENGTH(tags)); } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) { if (i < LENGTH(tags)) {
click = ClkTagBar; click = ClkTagBar;
arg.ui = 1 << i; arg.ui = 1 << i;
@ -886,33 +892,6 @@ destroynotify(XEvent *e)
unmanage(c->swallowing, 1); unmanage(c->swallowing, 1);
} }
void
deck(Monitor *m) {
unsigned int i, n, h, mw, my, ns;
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;
ns = m->nmaster > 0 ? 2 : 1;
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
} else {
mw = m->ww;
ns = 1;
}
for(i = 0, my = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if(i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
my += HEIGHT(c) + gappx;
}
else
resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False);
}
void void
detach(Client *c) detach(Client *c)
{ {
@ -972,27 +951,37 @@ drawbar(Monitor *m)
for (c = m->clients; c; c = c->next) { for (c = m->clients; c; c = c->next) {
if (ISVISIBLE(c)) if (ISVISIBLE(c))
n++; n++;
occ |= c->tags; occ |= c->tags == TAGMASK ? 0 : c->tags;
if (c->isurgent) if (c->isurgent)
urg |= c->tags; urg |= c->tags;
} }
x = 0; x = 0;
for (i = 0; i < LENGTH(tags); i++) { for (i = 0; i < LENGTH(tags); i++) {
/* Do not draw vacant tags */
if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
w = TEXTW(tags[i]); w = TEXTW(tags[i]);
drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeNorm])); drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeNorm : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw, if (ulineall || m->tagset[m->seltags] & 1 << i) { /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
m == selmon && selmon->sel && selmon->sel->tags & 1 << i, if (m == selmon)
urg & 1 << i); drw_setscheme(drw, scheme[SchemeHid]);
drw_rect(drw, x + w * 0.0675, bh - ulinestroke - ulinevoffset, w * 0.875, ulinestroke, 1, 0);
} else if (occ & 1 << i) {
drw_setscheme(drw, scheme[SchemeNorm]);
if (urg)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 1);
else
drw_rect(drw, x + w * 0.375, bh - ulinestroke - ulinevoffset, w * 0.25, ulinestroke, 1, 0);
}
x += w; x += w;
} }
w = TEXTW(m->ltsymbol); w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeLay]); drw_setscheme(drw, scheme[SchemeSel]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
w = TEXTW(wfsymbol); w = TEXTW(wfsymbol);
drw_setscheme(drw, scheme[SchemeWf]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, wfsymbol, 0); x = drw_text(drw, x, 0, w, bh, lrpad / 2, wfsymbol, 0);
if ((w = m->ww - tw - x) > bh) { if ((w = m->ww - tw - x) > bh) {
@ -1002,13 +991,11 @@ drawbar(Monitor *m)
for (c = m->clients; c; c = c->next) { for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c)) if (!ISVISIBLE(c))
continue; continue;
if (HIDDEN(c))
if (m->sel == c && m == selmon) scm = SchemeHid;
drw_setscheme(drw, scheme[SchemeSel]);
else if (HIDDEN(c))
drw_setscheme(drw, scheme[SchemeHid]);
else else
drw_setscheme(drw, scheme[SchemeNorm]); scm = SchemeNorm;
drw_setscheme(drw, scheme[scm]);
if (remainder >= 0) { if (remainder >= 0) {
if (remainder == 0) { if (remainder == 0) {
@ -1016,19 +1003,20 @@ drawbar(Monitor *m)
} }
remainder--; remainder--;
} }
mid = (tabw - (int)TEXTW(c->name)) / 2;
mid = mid >= lrpad / 2 ? mid : lrpad / 2;
drw_text(drw, x, 0, tabw - 2 * sp, bh, mid, c->name, 0);
char name[512]; if (!HIDDEN(c)) {
if (m->sel == c) {
if (m == selmon)
drw_setscheme(drw, scheme[SchemeHid]);
drw_rect(drw, x + tabw * 0.0675, bh - ulinestroke - ulinevoffset, tabw * 0.875 - ulinepad * 2, ulinestroke, 1, 0);
} else {
drw_rect(drw, x + tabw * 0.375, bh - ulinestroke - ulinevoffset, tabw * 0.25 - ulinepad * 2, ulinestroke, 1, 0);
}
}
if (c->isalwaysontop && c->isfloating)
snprintf(name, sizeof name, "%s %s", topicon, c->name);
else
snprintf(name, sizeof name, c->name);
mid = ((tabw - (int)TEXTW(name)) / 2) + lrpad / 2;
if ( tabw < (int)TEXTW(name) + lrpad )
mid = lrpad / 2;
drw_text(drw, x, 0, tabw, bh, mid, name, 0);
x += tabw; x += tabw;
} }
} else { } else {
@ -1861,8 +1849,6 @@ nexttiled(Client *c)
void void
movestack(const Arg *arg) { movestack(const Arg *arg) {
Client *c = NULL, *p = NULL, *pc = NULL, *i; Client *c = NULL, *p = NULL, *pc = NULL, *i;
if (!selmon->sel)
return;
if(arg->i > 0) { if(arg->i > 0) {
/* find the client after selmon->sel */ /* find the client after selmon->sel */
@ -2192,16 +2178,6 @@ restack(Monitor *m)
return; return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange) if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win); XRaiseWindow(dpy, m->sel->win);
/* raise the aot window */
for(Monitor *m_search = mons; m_search; m_search = m_search->next){
for(c = m_search->clients; c; c = c->next){
if(c->isalwaysontop){
XRaiseWindow(dpy, c->win);
}
}
}
if (m->lt[m->sellt]->arrange) { if (m->lt[m->sellt]->arrange) {
wc.stack_mode = Below; wc.stack_mode = Below;
wc.sibling = m->barwin; wc.sibling = m->barwin;
@ -2511,14 +2487,9 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur); cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */ /* init appearance */
if (LENGTH(tags) > LENGTH(tagsel))
die("too few color schemes for the tags");
scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++) for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3); scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *));
for (i = 0; i < LENGTH(tagsel); i++)
tagscheme[i] = drw_scm_create(drw, tagsel[i], tagalpha, 2);
/* init bars */ /* init bars */
updatebars(); updatebars();
updatestatus(); updatestatus();
@ -2602,14 +2573,12 @@ showhide(Client *c)
return; return;
if (ISVISIBLE(c)) { if (ISVISIBLE(c)) {
/* show clients top down */ /* show clients top down */
XMoveWindow(dpy, c->win, c->x, c->y); window_map(dpy, c, 1);
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
resize(c, c->x, c->y, c->w, c->h, 0);
showhide(c->snext); showhide(c->snext);
} else { } else {
/* hide clients bottom up */ /* hide clients bottom up */
showhide(c->snext); showhide(c->snext);
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y); window_unmap(dpy, c->win, root, 1);
} }
} }
@ -2755,7 +2724,6 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfullscreen if (selmon->sel->isfullscreen
&& !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */ && !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */
return; return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating) if (selmon->sel->isfloating)
/* restore last known float dimensions */ /* restore last known float dimensions */
@ -2775,19 +2743,6 @@ togglefloating(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
void
togglealwaysontop(const Arg *arg)
{
Client *c;
if (!selmon->sel)
return;
if (selmon->sel->isfullscreen)
return;
selmon->sel->isalwaysontop = !selmon->sel->isalwaysontop;
arrange(selmon);
}
void void
togglefakefullscr(const Arg *arg) togglefakefullscr(const Arg *arg)
{ {
@ -2869,7 +2824,7 @@ togglewin(const Arg *arg)
showwin(c); showwin(c);
focus(c); focus(c);
restack(selmon); restack(selmon);
/* XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); */ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
} }
} }
@ -3210,6 +3165,51 @@ updatewmhints(Client *c)
} }
} }
void
window_set_state(Display *dpy, Window win, long state)
{
long data[] = { state, None };
XChangeProperty(dpy, win, wmatom[WMState], wmatom[WMState], 32,
PropModeReplace, (unsigned char*)data, 2);
}
void
window_map(Display *dpy, Client *c, int deiconify)
{
Window win = c->win;
if (deiconify)
window_set_state(dpy, win, NormalState);
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
XMapWindow(dpy, win);
}
void
window_unmap(Display *dpy, Window win, Window root, int iconify)
{
static XWindowAttributes ca, ra;
XGrabServer(dpy);
XGetWindowAttributes(dpy, root, &ra);
XGetWindowAttributes(dpy, win, &ca);
/* Prevent UnmapNotify events */
XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
XSelectInput(dpy, win, ca.your_event_mask & ~StructureNotifyMask);
XUnmapWindow(dpy, win);
if (iconify)
window_set_state(dpy, win, IconicState);
XSelectInput(dpy, root, ra.your_event_mask);
XSelectInput(dpy, win, ca.your_event_mask);
XUngrabServer(dpy);
}
void void
view(const Arg *arg) view(const Arg *arg)
{ {

View File

@ -0,0 +1,48 @@
:100644 100644 f1d86b2 0000000 M dwm.c
diff --git a/dwm.c b/dwm.c
index f1d86b2..d41cc14 100644
--- a/dwm.c
+++ b/dwm.c
@@ -433,9 +433,15 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
- do
+ unsigned int occ = 0;
+ for(c = m->clients; c; c=c->next)
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
+ do {
+ /* Do not reserve space for vacant tags */
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
x += TEXTW(tags[i]);
- while (ev->x >= x && ++i < LENGTH(tags));
+ } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -715,19 +721,18 @@ drawbar(Monitor *m)
}
for (c = m->clients; c; c = c->next) {
- occ |= c->tags;
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
+ /* Do not draw vacant tags */
+ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- urg & 1 << i);
x += w;
}
w = TEXTW(m->ltsymbol);

View File

@ -1,61 +0,0 @@
diff --git a/config.def.h b/config.def.h
index 1c0b587..80d0e6e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -21,6 +21,20 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+static const char *tagsel[][2] = {
+ { "#ffffff", "#ff0000" },
+ { "#ffffff", "#ff7f00" },
+ { "#000000", "#ffff00" },
+ { "#000000", "#00ff00" },
+ { "#ffffff", "#0000ff" },
+ { "#ffffff", "#4b0082" },
+ { "#ffffff", "#9400d3" },
+ { "#000000", "#ffffff" },
+ { "#ffffff", "#000000" },
+};
+
+static const unsigned int tagalpha[] = { OPAQUE, baralpha };
+
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
diff --git a/dwm.c b/dwm.c
index b0b3466..23d1c46 100644
--- a/dwm.c
+++ b/dwm.c
@@ -264,6 +264,7 @@ static Atom wmatom[WMLast], netatom[NetLast];
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
+static Clr **tagscheme;
static Display *dpy;
static Drw *drw;
static Monitor *mons, *selmon;
@@ -717,7 +718,7 @@ drawbar(Monitor *m)
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
- drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
+ drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeNorm]));
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
@@ -1568,9 +1569,14 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
+ if (LENGTH(tags) > LENGTH(tagsel))
+ die("too few color schemes for the tags");
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
+ tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *));
+ for (i = 0; i < LENGTH(tagsel); i++)
+ tagscheme[i] = drw_scm_create(drw, tagsel[i], tagalpha, 2);
/* init bars */
updatebars();
updatestatus();

View File

@ -0,0 +1,27 @@
diff -pu dwm.git/config.def.h dwm.underlinetags/config.def.h
--- dwm.git/config.def.h 2021-02-27 20:04:32.030570909 -0600
+++ dwm.underlinetags/config.def.h 2021-03-16 16:42:26.278703624 -0500
@@ -21,6 +21,11 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
+static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
+static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
+static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
+
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
diff -pu dwm.git/dwm.c dwm.underlinetags/dwm.c
--- dwm.git/dwm.c 2021-02-27 20:04:32.030570909 -0600
+++ dwm.underlinetags/dwm.c 2021-03-16 16:41:21.468077151 -0500
@@ -719,6 +719,8 @@ drawbar(Monitor *m)
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
+ if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
+ drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,

View File

@ -0,0 +1,83 @@
diff --git a/dwm.c b/dwm.c
index e5efb6a..eaf0333 100644
--- a/dwm.c
+++ b/dwm.c
@@ -228,6 +228,9 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void window_set_state(Display *dpy, Window win, long state);
+static void window_map(Display *dpy, Client *c, int deiconify);
+static void window_unmap(Display *dpy, Window win, Window root, int iconify);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -1617,14 +1620,12 @@ showhide(Client *c)
return;
if (ISVISIBLE(c)) {
/* show clients top down */
- XMoveWindow(dpy, c->win, c->x, c->y);
- if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
- resize(c, c->x, c->y, c->w, c->h, 0);
+ window_map(dpy, c, 1);
showhide(c->snext);
} else {
/* hide clients bottom up */
showhide(c->snext);
- XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+ window_unmap(dpy, c->win, root, 1);
}
}
@@ -2032,6 +2033,51 @@ updatewmhints(Client *c)
}
}
+void
+window_set_state(Display *dpy, Window win, long state)
+{
+ long data[] = { state, None };
+
+ XChangeProperty(dpy, win, wmatom[WMState], wmatom[WMState], 32,
+ PropModeReplace, (unsigned char*)data, 2);
+}
+
+void
+window_map(Display *dpy, Client *c, int deiconify)
+{
+ Window win = c->win;
+
+ if (deiconify)
+ window_set_state(dpy, win, NormalState);
+
+ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
+ XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
+ XMapWindow(dpy, win);
+}
+
+void
+window_unmap(Display *dpy, Window win, Window root, int iconify)
+{
+ static XWindowAttributes ca, ra;
+
+ XGrabServer(dpy);
+ XGetWindowAttributes(dpy, root, &ra);
+ XGetWindowAttributes(dpy, win, &ca);
+
+ /* Prevent UnmapNotify events */
+ XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
+ XSelectInput(dpy, win, ca.your_event_mask & ~StructureNotifyMask);
+
+ XUnmapWindow(dpy, win);
+
+ if (iconify)
+ window_set_state(dpy, win, IconicState);
+
+ XSelectInput(dpy, root, ra.your_event_mask);
+ XSelectInput(dpy, win, ca.your_event_mask);
+ XUngrabServer(dpy);
+}
+
void
view(const Arg *arg)
{

View File

@ -1,103 +0,0 @@
From 9cd160c4ba9c345c24644a7da77cc4f04fc93c4e Mon Sep 17 00:00:00 2001
From: Matt Quintanilla <matt@mattquintanilla.xyz>
Date: Fri, 13 Oct 2023 20:11:08 +0100
Subject: [PATCH] alwaysontop for all
---
config.def.h | 1 +
dwm.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..c3c7edd 100644
--- a/config.def.h
+++ b/config.def.h
@@ -78,6 +78,7 @@ static Key keys[] = {
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY|ShiftMask, XK_space, togglealwaysontop, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
diff --git a/dwm.c b/dwm.c
index 4465af1..8d54b26 100644
--- a/dwm.c
+++ b/dwm.c
@@ -92,7 +92,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+ int isfixed, iscentered, isfloating, isalwaysontop, isurgent, neverfocus, oldstate, isfullscreen;
Client *next;
Client *snext;
Monitor *mon;
@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
+static void togglealwaysontop(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@@ -732,8 +733,11 @@ drawbar(Monitor *m)
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
- if (m->sel->isfloating)
+ if (m->sel->isfloating) {
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
+ if (m->sel->isalwaysontop)
+ drw_rect(drw, x + boxs, bh - boxw, boxw, boxw, 0, 0);
+ }
} else {
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
@@ -1356,6 +1360,17 @@ restack(Monitor *m)
return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win);
+
+ /* raise the aot window */
+ for(Monitor *m_search = mons; m_search; m_search = m_search->next){
+ for(c = m_search->clients; c; c = c->next){
+ if(c->isalwaysontop){
+ XRaiseWindow(dpy, c->win);
+ }
+ }
+ }
+
if (m->lt[m->sellt]->arrange) {
wc.stack_mode = Below;
wc.sibling = m->barwin;
@@ -1716,6 +1731,32 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0);
+ else
+ selmon->sel->isalwaysontop = 0; /* disabled, turn this off too */
+ arrange(selmon);
+}
+
+void
+togglealwaysontop(const Arg *arg)
+{
+ if (!selmon->sel)
+ return;
+ if (selmon->sel->isfullscreen)
+ return;
+
+ if(selmon->sel->isalwaysontop){
+ selmon->sel->isalwaysontop = 0;
+ }else{
+ c->isalwaysontop = 0;
+
+ }
+
arrange(selmon);
}
--
2.31.1

View File

@ -1,77 +0,0 @@
From a071b060a1b9b94bcb167b988cf7774ceb870aad Mon Sep 17 00:00:00 2001
From: Jack Bird <jack.bird@durham.ac.uk>
Date: Mon, 2 Aug 2021 18:44:05 +0100
Subject: [PATCH] deck patch works with 6.2
---
config.def.h | 2 ++
dwm.c | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/config.def.h b/config.def.h
index a2ac963..d865e18 100644
--- a/config.def.h
+++ b/config.def.h
@@ -42,6 +42,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[D]", deck },
};
/* key definitions */
@@ -77,6 +78,7 @@ static Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_r, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 5e4d494..c67ff91 100644
--- a/dwm.c
+++ b/dwm.c
@@ -157,6 +157,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void deck(Monitor *m);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -655,6 +656,31 @@ destroynotify(XEvent *e)
unmanage(c, 1);
}
+void
+deck(Monitor *m) {
+ unsigned int i, n, h, mw, my;
+ 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;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+ mw = m->ww;
+ for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if(i < m->nmaster) {
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
+ my += HEIGHT(c);
+ }
+ else
+ resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
+}
+
void
detach(Client *c)
{
--
2.32.0

View File

@ -1,55 +0,0 @@
From a9e442ec18683e2255ffef74404c283bbb0b6381 Mon Sep 17 00:00:00 2001
From: aleks <aleks.stier@icloud.com>
Date: Thu, 23 May 2019 23:27:59 +0200
Subject: [PATCH] Make deck-patch work with the tilegap-patch
Apply this patch on top of the deck-patch to make it work with the
tilegap-patch.
---
dwm.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dwm.c b/dwm.c
index 5b68242..1c17891 100644
--- a/dwm.c
+++ b/dwm.c
@@ -656,7 +656,7 @@ createmon(void)
void
deck(Monitor *m) {
- unsigned int i, n, h, mw, my;
+ unsigned int i, n, h, mw, my, ns;
Client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@@ -665,18 +665,20 @@ deck(Monitor *m) {
if(n > m->nmaster) {
mw = m->nmaster ? m->ww * m->mfact : 0;
+ ns = m->nmaster > 0 ? 2 : 1;
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
- }
- else
+ } else {
mw = m->ww;
- for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ ns = 1;
+ }
+ for(i = 0, my = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if(i < m->nmaster) {
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
- my += HEIGHT(c);
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
+ resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
+ my += HEIGHT(c) + gappx;
}
else
- resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
+ resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False);
}
void
--
2.21.0

View File

@ -4,5 +4,4 @@ cat <<EOF | xmenu
[]= Tiled Layout 0 []= Tiled Layout 0
><> Floating Layout 1 ><> Floating Layout 1
[M] Monocle Layout 2 [M] Monocle Layout 2
[D] Deck Layout 3
EOF EOF