dwm

[fork] dynamic window manager
Log | Files | Refs | README | LICENSE

commit e633c0b5176ddd66fbf1ab190fa72ee0fefb99d4
parent 66246fd38f6de2a32a1c4a525b6264975e3056a0
Author: hhvn <hayden@haydenvh.com>
Date:   Sun, 27 Dec 2020 15:07:33 +0000

dwm-6.2.diff: update

Diffstat:
Mdwm-6.2.diff | 188+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 147 insertions(+), 41 deletions(-)

diff --git a/dwm-6.2.diff b/dwm-6.2.diff @@ -12,7 +12,7 @@ index d221f09..a5a021d 100644 copy of this software and associated documentation files (the "Software"), diff --git a/config.h b/config.h new file mode 100644 -index 0000000..6ac0d79 +index 0000000..10ca556 --- /dev/null +++ b/config.h @@ -0,0 +1,97 @@ @@ -27,11 +27,12 @@ index 0000000..6ac0d79 +static const char *fonts[] = { "monospace:size=8" }; +static const char *colors[][3] = { + /* fg bg border */ -+ [SchemeNorm] = { "#bbbbbb", "#0a0a10", "#0a0a10" }, -+ [SchemeSel] = { "#eeeeee", "#30404e", "#892b2b" }, -+ [SchemeStat] = { "#eeeeee", "#0a2126", "#0a2126" }, -+ [SchemeNormWin] = { "#bbbbbb", "#24284c", "#0a0a10" }, -+ [SchemeUrgent] = { "#892b2b", "#0a0a10", "#0a0a10" }, ++ [SchemeNorm] = { "#bbbbbb", "#0a0a10", "#0a0a10" }, ++ [SchemeSel] = { "#eeeeee", "#30404e", "#892b2b" }, ++ [SchemeStat] = { "#eeeeee", "#0a2126", "#0a2126" }, ++ [SchemeBarInact] = { "#bbbbbb", "#24284c", "#0a0a10" }, ++ [SchemeNormFloat] = { "#bbbbbb", "#0a0a10", "#0a2126" }, ++ [SchemeUrgent] = { "#892b2b", "#0a0a10", "#0a0a10" }, +}; + +/* tagging */ @@ -40,7 +41,7 @@ index 0000000..6ac0d79 +static const Rule rules[] = { + { "Gimp", NULL, NULL, 1 << 7, 0, 0 }, + { "mpv", NULL, NULL, 1 << 1, 0, 0 }, -+ { "mpvrcp", NULL, NULL, 1 << 0, 1, 0 }, ++ { "mpvrcp", NULL, NULL, 1 << 2, 1, 0 }, +}; + +/* layout(s) */ @@ -49,7 +50,7 @@ index 0000000..6ac0d79 +static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ + +static const Layout layouts[] = { -+ /* symbol arrange function */ ++ /* symbol arrange function */ + { "|=", tile }, /* first entry is default */ + { ".:", NULL }, /* no layout function means floating behavior */ + { "M", monocle }, @@ -100,7 +101,6 @@ index 0000000..6ac0d79 + LAYOUT( XK_4, 4) + LAYOUT( XK_5, 5) + LAYOUT( XK_6, 6) -+ LAYOUT( XK_7, 7) + LAYOUT( XK_0, 2) + /* Tags */ + TAGKEYS( XK_1, 0) @@ -114,7 +114,7 @@ index 0000000..6ac0d79 + TAGKEYS( XK_9, 8) +}; diff --git a/dwm.c b/dwm.c -index 4465af1..09f86e7 100644 +index 4465af1..7963daf 100644 --- a/dwm.c +++ b/dwm.c @@ -30,12 +30,14 @@ @@ -154,7 +154,7 @@ index 4465af1..09f86e7 100644 /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel }; /* color schemes */ -+enum { SchemeNorm, SchemeSel, SchemeStat, SchemeNormWin, SchemeUrgent }; /* color schemes */ ++enum { SchemeNorm, SchemeSel, SchemeStat, SchemeBarInact, SchemeUrgent, SchemeNormFloat}; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ @@ -363,7 +363,7 @@ index 4465af1..09f86e7 100644 m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); -@@ -692,23 +678,129 @@ dirtomon(int dir) +@@ -692,23 +678,130 @@ dirtomon(int dir) return m; } @@ -482,6 +482,7 @@ index 4465af1..09f86e7 100644 int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; ++ char layout[16]; Client *c; /* draw status first so it can be overdrawn by tags later */ @@ -499,7 +500,7 @@ index 4465af1..09f86e7 100644 occ |= c->tags; if (c->isurgent) urg |= c->tags; -@@ -716,10 +808,13 @@ drawbar(Monitor *m) +@@ -716,29 +809,65 @@ drawbar(Monitor *m) x = 0; for (i = 0; i < LENGTH(tags); i++) { w = TEXTW(tags[i]); @@ -515,8 +516,14 @@ index 4465af1..09f86e7 100644 m == selmon && selmon->sel && selmon->sel->tags & 1 << i, urg & 1 << i); x += w; -@@ -729,16 +824,42 @@ drawbar(Monitor *m) - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + } +- w = blw = TEXTW(m->ltsymbol); ++ ++ snprintf(layout, sizeof(layout), "%s%d", m->ltsymbol, n); ++ w = blw = TEXTW(layout); + drw_setscheme(drw, scheme[SchemeNorm]); +- x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); ++ x = drw_text(drw, x, 0, w, bh, lrpad / 2, layout, 0); if ((w = m->ww - sw - x) > bh) { - if (m->sel) { @@ -533,7 +540,7 @@ index 4465af1..09f86e7 100644 + if (m->sel == c && m == selmon) + scm = SchemeSel; + else -+ scm = SchemeNormWin; ++ scm = SchemeBarInact; + drw_setscheme(drw, scheme[scm]); + + if (remainder >= 0) { @@ -551,11 +558,17 @@ index 4465af1..09f86e7 100644 + } } else { - drw_setscheme(drw, scheme[SchemeNorm]); -+ if (m == selmon) -+ drw_setscheme(drw, scheme[SchemeNormWin]); -+ else +- drw_rect(drw, x, 0, w, bh, 1, 1); ++ if (m == selmon) { ++ drw_setscheme(drw, scheme[SchemeSel]); ++ drw_rect(drw, x, 0, w - borderpx, bh, 1, 1); ++ /* draw seperator */ ++ drw_setscheme(drw, scheme[SchemeNorm]); ++ drw_rect(drw, x + w - borderpx, 0, borderpx, bh, 1, 1); ++ } else { + drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); ++ drw_rect(drw, x, 0, w, bh, 1, 1); ++ } } } + @@ -564,7 +577,7 @@ index 4465af1..09f86e7 100644 drw_map(drw, m->barwin, 0, 0, m->ww, bh); } -@@ -794,7 +915,6 @@ focus(Client *c) +@@ -794,7 +923,6 @@ focus(Client *c) seturgent(c, 0); detachstack(c); attachstack(c); @@ -572,7 +585,7 @@ index 4465af1..09f86e7 100644 XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); setfocus(c); } else { -@@ -924,27 +1044,6 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) +@@ -924,27 +1052,6 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) return 1; } @@ -600,9 +613,24 @@ index 4465af1..09f86e7 100644 void grabkeys(void) { -@@ -1057,12 +1156,11 @@ manage(Window w, XWindowAttributes *wa) +@@ -1051,18 +1158,25 @@ manage(Window w, XWindowAttributes *wa) + + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); +- XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); ++ if (c->isfloating) ++ XSetWindowBorder(dpy, w, scheme[SchemeNormFloat][ColBorder].pixel); ++ else ++ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); + configure(c); /* propagates border_width, if size doesn't change */ + updatewindowtype(c); updatesizehints(c); updatewmhints(c); ++ ++ /* floating windows: do not cover bar */ ++ c->y = c->mon->my + gappx + 15 - borderpx; ++ c->x = c->mon->my + ((c->mon->mw - c->w) / 2); ++ XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); - grabbuttons(c, 0); if (!c->isfloating) @@ -614,19 +642,19 @@ index 4465af1..09f86e7 100644 attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &(c->win), 1); -@@ -1110,9 +1208,9 @@ monocle(Monitor *m) +@@ -1109,10 +1223,8 @@ monocle(Monitor *m) + for (c = m->clients; c; c = c->next) if (ISVISIBLE(c)) n++; - if (n > 0) /* override layout symbol */ +- if (n > 0) /* override layout symbol */ - snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); -+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "M%d", n); for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) - resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); + resize(c, m->wx + m->gappx, m->wy + m->gappx, (m->ww - 2 * c->bw) - 2*m->gappx, (m->wh - 2 * c->bw) - 2*m->gappx, 0); } void -@@ -1132,64 +1230,14 @@ motionnotify(XEvent *e) +@@ -1132,64 +1244,14 @@ motionnotify(XEvent *e) mon = m; } @@ -699,7 +727,7 @@ index 4465af1..09f86e7 100644 } Client * -@@ -1287,71 +1335,12 @@ resizeclient(Client *c, int x, int y, int w, int h) +@@ -1287,71 +1349,12 @@ resizeclient(Client *c, int x, int y, int w, int h) XSync(dpy, False); } @@ -772,7 +800,7 @@ index 4465af1..09f86e7 100644 if (!m->sel) return; if (m->sel->isfloating || !m->lt[m->sellt]->arrange) -@@ -1417,7 +1406,7 @@ sendmon(Client *c, Monitor *m) +@@ -1417,7 +1420,7 @@ sendmon(Client *c, Monitor *m) detachstack(c); c->mon = m; c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ @@ -781,7 +809,20 @@ index 4465af1..09f86e7 100644 attachstack(c); focus(NULL); arrange(NULL); -@@ -1497,6 +1486,18 @@ setfullscreen(Client *c, int fullscreen) +@@ -1472,7 +1475,12 @@ setfocus(Client *c) + void + setfullscreen(Client *c, int fullscreen) + { ++ Client *c2; ++ + if (fullscreen && !c->isfullscreen) { ++ for (c2 = selmon->clients; c2; c2 = c2->next) ++ if (c2->isfullscreen) ++ return; /* prevent fullscreening of multiple clients */ + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); + c->isfullscreen = 1; +@@ -1497,6 +1505,18 @@ setfullscreen(Client *c, int fullscreen) } } @@ -800,7 +841,7 @@ index 4465af1..09f86e7 100644 void setlayout(const Arg *arg) { -@@ -1563,16 +1564,20 @@ setup(void) +@@ -1563,16 +1583,20 @@ setup(void) netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); /* init cursors */ @@ -823,7 +864,7 @@ index 4465af1..09f86e7 100644 /* supporting window for NetWMCheck */ wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0); XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32, -@@ -1639,8 +1644,6 @@ sigchld(int unused) +@@ -1639,8 +1663,6 @@ sigchld(int unused) void spawn(const Arg *arg) { @@ -832,7 +873,7 @@ index 4465af1..09f86e7 100644 if (fork() == 0) { if (dpy) close(ConnectionNumber(dpy)); -@@ -1683,28 +1686,19 @@ tile(Monitor *m) +@@ -1683,28 +1705,19 @@ tile(Monitor *m) if (n > m->nmaster) mw = m->nmaster ? m->ww * m->mfact : 0; else @@ -869,7 +910,7 @@ index 4465af1..09f86e7 100644 void togglefloating(const Arg *arg) { -@@ -1719,6 +1713,13 @@ togglefloating(const Arg *arg) +@@ -1719,6 +1732,13 @@ togglefloating(const Arg *arg) arrange(selmon); } @@ -883,15 +924,20 @@ index 4465af1..09f86e7 100644 void toggletag(const Arg *arg) { -@@ -1751,7 +1752,6 @@ unfocus(Client *c, int setfocus) +@@ -1751,8 +1771,10 @@ unfocus(Client *c, int setfocus) { if (!c) return; - grabbuttons(c, 0); - XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); +- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); ++ if (c->isfloating) ++ XSetWindowBorder(dpy, c->win, scheme[SchemeNormFloat][ColBorder].pixel); ++ else ++ XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); if (setfocus) { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); -@@ -1811,7 +1811,7 @@ updatebars(void) + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); +@@ -1811,7 +1833,7 @@ updatebars(void) for (m = mons; m; m = m->next) { if (m->barwin) continue; @@ -900,7 +946,7 @@ index 4465af1..09f86e7 100644 CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); -@@ -1826,11 +1826,11 @@ updatebarpos(Monitor *m) +@@ -1826,11 +1848,11 @@ updatebarpos(Monitor *m) m->wy = m->my; m->wh = m->mh; if (m->showbar) { @@ -916,7 +962,7 @@ index 4465af1..09f86e7 100644 } void -@@ -1897,7 +1897,7 @@ updategeom(void) +@@ -1897,7 +1919,7 @@ updategeom(void) m->clients = c->next; detachstack(c); c->mon = mons; @@ -925,7 +971,7 @@ index 4465af1..09f86e7 100644 attachstack(c); } if (m == selmon) -@@ -1989,7 +1989,7 @@ updatestatus(void) +@@ -1989,7 +2011,7 @@ updatestatus(void) { if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) strcpy(stext, "dwm-"VERSION); @@ -934,7 +980,7 @@ index 4465af1..09f86e7 100644 } void -@@ -2147,3 +2147,174 @@ main(int argc, char *argv[]) +@@ -2147,3 +2169,174 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } @@ -1109,3 +1155,63 @@ index 4465af1..09f86e7 100644 + } + /* XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char *)&netatom[NetWMFullscreen], 1); */ +} +diff --git a/makefile b/makefile +new file mode 100644 +index 0000000..20c8375 +--- /dev/null ++++ b/makefile +@@ -0,0 +1,54 @@ ++# dwm - dynamic window manager ++# See LICENSE file for copyright and license details. ++ ++include config.mk ++ ++SRC = drw.c dwm.c util.c ++OBJ = ${SRC:.c=.o} ++ ++all: options dwm ++ ++options: ++ @echo dwm build options: ++ @echo "CFLAGS = ${CFLAGS}" ++ @echo "LDFLAGS = ${LDFLAGS}" ++ @echo "CC = ${CC}" ++ ++.c.o: ++ ${CC} -c ${CFLAGS} $< ++ ++${OBJ}: config.h config.mk ++ ++config.h: ++ cp config.def.h $@ ++ ++dwm: ${OBJ} ++ ${CC} -o $@ ${OBJ} ${LDFLAGS} ++ ++clean: ++ rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz ++ ++dist: clean ++ mkdir -p dwm-${VERSION} ++ cp -R LICENSE Makefile README config.def.h config.mk\ ++ dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION} ++ tar -cf dwm-${VERSION}.tar dwm-${VERSION} ++ gzip dwm-${VERSION}.tar ++ rm -rf dwm-${VERSION} ++ ++install: all ++ mkdir -p ${DESTDIR}${PREFIX}/bin ++ cp -f dwm ${DESTDIR}${PREFIX}/bin ++ chmod 755 ${DESTDIR}${PREFIX}/bin/dwm ++ mkdir -p ${DESTDIR}${MANPREFIX}/man1 ++ sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 ++ chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 ++ ++diff: ++ git diff cb3f58a -- `ls | sed '/dwm-6.2.diff/d'` > dwm-6.2.diff ++ ++uninstall: ++ rm -f ${DESTDIR}${PREFIX}/bin/dwm\ ++ ${DESTDIR}${MANPREFIX}/man1/dwm.1 ++ ++.PHONY: all options clean dist install uninstall