diff --git a/dwm-focusmaster-20200717-bb2e722.diff b/.pc/dwm-focusmaster-20200717-bb2e722.diff similarity index 100% rename from dwm-focusmaster-20200717-bb2e722.diff rename to .pc/dwm-focusmaster-20200717-bb2e722.diff diff --git a/dwm-gridmode-20170909-ceac8c9.diff b/.pc/dwm-gridmode-20170909-ceac8c9.diff similarity index 100% rename from dwm-gridmode-20170909-ceac8c9.diff rename to .pc/dwm-gridmode-20170909-ceac8c9.diff diff --git a/dwm-movestack-6.1.diff b/.pc/dwm-movestack-6.1.diff similarity index 100% rename from dwm-movestack-6.1.diff rename to .pc/dwm-movestack-6.1.diff diff --git a/dwm-scratchpad-6.2.diff b/.pc/dwm-scratchpad-6.2.diff similarity index 100% rename from dwm-scratchpad-6.2.diff rename to .pc/dwm-scratchpad-6.2.diff diff --git a/config.def.h b/config.def.h index cacc554..db48095 100644 --- a/config.def.h +++ b/config.def.h @@ -38,8 +38,8 @@ static int attachbelow = 1; /* 1 means attach after the currently active wind static const Layout layouts[] = { /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ + { "T", tile }, /* first entry is default */ + { "F", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, { "|M|", centeredmaster }, { ">M>", centeredfloatingmaster }, @@ -68,6 +68,7 @@ static Key keys[] = { { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, + { MODKEY|ControlMask, XK_space, focusmaster, {0} }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstackvis, {.i = +1 } }, { MODKEY, XK_k, focusstackvis, {.i = -1 } }, diff --git a/dwm-5.7.2-statuscolors.diff b/dwm-5.7.2-statuscolors.diff new file mode 100644 index 0000000..7899275 --- /dev/null +++ b/dwm-5.7.2-statuscolors.diff @@ -0,0 +1,234 @@ +diff -r 2bcd25cce4ab config.def.h +--- a/config.def.h Sun Sep 27 20:20:14 2009 +0100 ++++ b/config.def.h Mon Oct 05 22:01:49 2009 -0300 +@@ -1,13 +1,16 @@ + /* See LICENSE file for copyright and license details. */ + + /* appearance */ ++#define NUMCOLORS 4 // need at least 3 ++static const char colors[NUMCOLORS][ColLast][8] = { ++ // border foreground background ++ { "#cccccc", "#000000", "#cccccc" }, // 0 = normal ++ { "#0066ff", "#ffffff", "#0066ff" }, // 1 = selected ++ { "#0066ff", "#0066ff", "#ffffff" }, // 2 = urgent/warning ++ { "#ff0000", "#ffffff", "#ff0000" }, // 3 = error ++ // add more here ++}; + static const char font[] = "-*-*-medium-*-*-*-14-*-*-*-*-*-*-*"; +-static const char normbordercolor[] = "#cccccc"; +-static const char normbgcolor[] = "#cccccc"; +-static const char normfgcolor[] = "#000000"; +-static const char selbordercolor[] = "#0066ff"; +-static const char selbgcolor[] = "#0066ff"; +-static const char selfgcolor[] = "#ffffff"; + static const unsigned int borderpx = 1; /* border pixel of windows */ + static const unsigned int snap = 32; /* snap pixel */ + static const Bool showbar = True; /* False means no bar */ +@@ -45,7 +48,7 @@ + #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + + /* commands */ +-static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; ++static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", colors[0][ColBG], "-nf", colors[0][ColFG], "-sb", colors[1][ColBG], "-sf", colors[1][ColFG], NULL }; + static const char *termcmd[] = { "uxterm", NULL }; + + static Key keys[] = { +diff -r 2bcd25cce4ab dwm.c +--- a/dwm.c Sun Sep 27 20:20:14 2009 +0100 ++++ b/dwm.c Mon Oct 05 22:01:49 2009 -0300 +@@ -48,6 +48,7 @@ + #define LENGTH(X) (sizeof X / sizeof X[0]) + #define MAX(A, B) ((A) > (B) ? (A) : (B)) + #define MIN(A, B) ((A) < (B) ? (A) : (B)) ++#define MAXCOLORS 8 + #define MOUSEMASK (BUTTONMASK|PointerMotionMask) + #define WIDTH(X) ((X)->w + 2 * (X)->bw) + #define HEIGHT(X) ((X)->h + 2 * (X)->bw) +@@ -95,8 +96,7 @@ + + typedef struct { + int x, y, w, h; +- unsigned long norm[ColLast]; +- unsigned long sel[ColLast]; ++ unsigned long colors[MAXCOLORS][ColLast]; + Drawable drawable; + GC gc; + struct { +@@ -172,8 +172,9 @@ + static Monitor *dirtomon(int dir); + static void drawbar(Monitor *m); + static void drawbars(void); +-static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); +-static void drawtext(const char *text, unsigned long col[ColLast], Bool invert); ++static void drawcoloredtext(char *text); ++static void drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]); ++static void drawtext(const char *text, unsigned long col[ColLast], Bool pad); + static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); +@@ -691,14 +692,13 @@ + dc.x = 0; + for(i = 0; i < LENGTH(tags); i++) { + dc.w = TEXTW(tags[i]); +- col = m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm; +- drawtext(tags[i], col, urg & 1 << i); +- drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, +- occ & 1 << i, urg & 1 << i, col); ++ col = dc.colors[ (m->tagset[m->seltags] & 1 << i ? 1:(urg & 1 << i ? 2:0))]; ++ drawtext(tags[i], col, True); ++ drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i, col); + dc.x += dc.w; + } + dc.w = blw = TEXTW(m->ltsymbol); +- drawtext(m->ltsymbol, dc.norm, False); ++ drawtext(m->ltsymbol, dc.colors[0], True); + dc.x += dc.w; + x = dc.x; + if(m == selmon) { /* status is only drawn on selected monitor */ +@@ -708,19 +708,19 @@ + dc.x = x; + dc.w = m->ww - x; + } +- drawtext(stext, dc.norm, False); ++ drawcoloredtext(stext); + } + else + dc.x = m->ww; + if((dc.w = dc.x - x) > bh) { + dc.x = x; + if(m->sel) { +- col = m == selmon ? dc.sel : dc.norm; +- drawtext(m->sel->name, col, False); +- drawsquare(m->sel->isfixed, m->sel->isfloating, False, col); ++ col = m == selmon ? dc.colors[1] : dc.colors[0]; ++ drawtext(m->sel->name, col, True); ++ drawsquare(m->sel->isfixed, m->sel->isfloating, col); + } + else +- drawtext(NULL, dc.norm, False); ++ drawtext(NULL, dc.colors[0], False); + } + XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0); + XSync(dpy, False); +@@ -735,12 +735,42 @@ + } + + void +-drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) { ++drawcoloredtext(char *text) { ++ Bool first=True; ++ char *buf = text, *ptr = buf, c = 1; ++ unsigned long *col = dc.colors[0]; ++ int i, ox = dc.x; ++ ++ while( *ptr ) { ++ for( i = 0; *ptr < 0 || *ptr > NUMCOLORS; i++, ptr++); ++ if( !*ptr ) break; ++ c=*ptr; ++ *ptr=0; ++ if( i ) { ++ dc.w = selmon->ww - dc.x; ++ drawtext(buf, col, first); ++ dc.x += textnw(buf, i) + textnw(&c,1); ++ if( first ) dc.x += ( dc.font.ascent + dc.font.descent ) / 2; ++ first = False; ++ } else if( first ) { ++ ox = dc.x += textnw(&c,1); ++ } ++ *ptr = c; ++ col = dc.colors[ c-1 ]; ++ buf = ++ptr; ++ } ++ if( !first ) dc.x-=(dc.font.ascent+dc.font.descent)/2; ++ drawtext(buf, col, True); ++ dc.x = ox; ++} ++ ++void ++drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]) { + int x; + XGCValues gcv; + XRectangle r = { dc.x, dc.y, dc.w, dc.h }; + +- gcv.foreground = col[invert ? ColBG : ColFG]; ++ gcv.foreground = col[ ColFG ]; + XChangeGC(dpy, dc.gc, GCForeground, &gcv); + x = (dc.font.ascent + dc.font.descent + 2) / 4; + r.x = dc.x + 1; +@@ -756,18 +786,18 @@ + } + + void +-drawtext(const char *text, unsigned long col[ColLast], Bool invert) { ++drawtext(const char *text, unsigned long col[ColLast], Bool pad) { + char buf[256]; + int i, x, y, h, len, olen; + XRectangle r = { dc.x, dc.y, dc.w, dc.h }; + +- XSetForeground(dpy, dc.gc, col[invert ? ColFG : ColBG]); ++ XSetForeground(dpy, dc.gc, col[ ColBG ]); + XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); + if(!text) + return; + olen = strlen(text); +- h = dc.font.ascent + dc.font.descent; +- y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; ++ h = pad ? (dc.font.ascent + dc.font.descent) : 0; ++ y = dc.y + ((dc.h + dc.font.ascent - dc.font.descent) / 2); + x = dc.x + (h / 2); + /* shorten text if necessary */ + for(len = MIN(olen, sizeof buf); len && textnw(text, len) > dc.w - h; len--); +@@ -776,7 +806,7 @@ + memcpy(buf, text, len); + if(len < olen) + for(i = len; i && i > len - 3; buf[--i] = '.'); +- XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]); ++ XSetForeground(dpy, dc.gc, col[ ColFG ]); + if(dc.font.set) + XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); + else +@@ -824,7 +854,7 @@ + detachstack(c); + attachstack(c); + grabbuttons(c, True); +- XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); ++ XSetWindowBorder(dpy, c->win, dc.colors[1][ColBorder]); + XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); + } + else +@@ -1132,7 +1162,7 @@ + } + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); +- XSetWindowBorder(dpy, w, dc.norm[ColBorder]); ++ XSetWindowBorder(dpy, w, dc.colors[0][ColBorder]); + configure(c); /* propagates border_width, if size doesn't change */ + updatesizehints(c); + XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); +@@ -1498,12 +1528,11 @@ + cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); + cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); + /* init appearance */ +- dc.norm[ColBorder] = getcolor(normbordercolor); +- dc.norm[ColBG] = getcolor(normbgcolor); +- dc.norm[ColFG] = getcolor(normfgcolor); +- dc.sel[ColBorder] = getcolor(selbordercolor); +- dc.sel[ColBG] = getcolor(selbgcolor); +- dc.sel[ColFG] = getcolor(selfgcolor); ++ for(int i=0; iwin, dc.norm[ColBorder]); ++ XSetWindowBorder(dpy, c->win, dc.colors[0][ColBorder]); + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + } + diff --git a/dwm-centeredwindowname-20180909-6.2.diff b/dwm-centeredwindowname-20180909-6.2.diff new file mode 100644 index 0000000..5e09b6c --- /dev/null +++ b/dwm-centeredwindowname-20180909-6.2.diff @@ -0,0 +1,27 @@ +From bd6efd81eabab77c91a3e95b528b19db2d58525b Mon Sep 17 00:00:00 2001 +From: Sacules +Date: Sun, 9 Sep 2018 17:12:58 -0300 +Subject: [PATCH] Centers windows names on status bar. + +--- + dwm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dwm.c b/dwm.c +index 4465af1..9d5ef7a 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -730,8 +730,9 @@ drawbar(Monitor *m) + + if ((w = m->ww - sw - x) > bh) { + if (m->sel) { ++ int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x; + drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); +- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); ++ drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0); + if (m->sel->isfloating) + drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); + } else { +-- +2.18.0 + diff --git a/dwm-colorbar-6.2.diff b/dwm-colorbar-6.2.diff new file mode 100644 index 0000000..91c067d --- /dev/null +++ b/dwm-colorbar-6.2.diff @@ -0,0 +1,68 @@ +diff --git a/config.def.h b/config.def.h +index 1c0b587..a516645 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -16,6 +16,11 @@ static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++ [SchemeStatus] = { col_gray3, col_gray1, "#000000" }, // Statusbar right {text,background,not used but cannot be empty} ++ [SchemeTagsSel] = { col_gray4, col_cyan, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty} ++ [SchemeTagsNorm] = { col_gray3, col_gray1, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty} ++ [SchemeInfoSel] = { col_gray4, col_cyan, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty} ++ [SchemeInfoNorm] = { col_gray3, col_gray1, "#000000" }, // infobar middle unselected {text,background,not used but cannot be empty} + }; + + /* tagging */ +diff --git a/dwm.c b/dwm.c +index 4465af1..0d1d2f7 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -59,7 +59,7 @@ + + /* enums */ + enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ +-enum { SchemeNorm, SchemeSel }; /* color schemes */ ++enum { SchemeNorm, SchemeSel, SchemeStatus, SchemeTagsSel, SchemeTagsNorm, SchemeInfoSel, SchemeInfoNorm }; /* color schemes */ + enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ +@@ -703,7 +703,7 @@ drawbar(Monitor *m) + + /* draw status first so it can be overdrawn by tags later */ + if (m == selmon) { /* status is only drawn on selected monitor */ +- drw_setscheme(drw, scheme[SchemeNorm]); ++ drw_setscheme(drw, scheme[SchemeStatus]); + sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ + drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); + } +@@ -716,7 +716,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, scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsNorm]); + 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, +@@ -725,17 +725,17 @@ drawbar(Monitor *m) + x += w; + } + w = blw = TEXTW(m->ltsymbol); +- drw_setscheme(drw, scheme[SchemeNorm]); ++ drw_setscheme(drw, scheme[SchemeTagsNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + + if ((w = m->ww - sw - x) > bh) { + if (m->sel) { +- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); ++ drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); + if (m->sel->isfloating) + drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); + } else { +- drw_setscheme(drw, scheme[SchemeNorm]); ++ drw_setscheme(drw, scheme[SchemeInfoNorm]); + drw_rect(drw, x, 0, w, bh, 1, 1); + } + } diff --git a/dwm-keymodes-5.8.2.diff b/dwm-keymodes-5.8.2.diff new file mode 100644 index 0000000..02f2780 --- /dev/null +++ b/dwm-keymodes-5.8.2.diff @@ -0,0 +1,239 @@ +diff -up ../dwm-5.8.2-0/config.def.h ./config.def.h +--- ../dwm-5.8.2-0/config.def.h 2010-06-10 22:47:51.660949000 +0200 ++++ ./config.def.h 2010-06-11 00:18:55.082073000 +0200 +@@ -16,6 +16,9 @@ static const Bool topbar = Tr + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + ++/* include(s) defining functions */ ++#include "keymodes.pre.h" ++ + static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, +@@ -47,9 +50,11 @@ static const Layout layouts[] = { + /* commands */ + static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; + static const char *termcmd[] = { "uxterm", NULL }; ++static const char *helpcmd[] = { "uxterm", "-e", "man", "dwm", NULL }; + + static Key keys[] = { + /* modifier key function argument */ ++ { MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} }, + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, +@@ -83,6 +88,30 @@ static Key keys[] = { + { MODKEY|ShiftMask, XK_q, quit, {0} }, + }; + ++static Key cmdkeys[] = { ++ /* modifier keys function argument */ ++ { 0, XK_Escape, clearcmd, {0} }, ++ { ControlMask, XK_c, clearcmd, {0} }, ++ { 0, XK_i, setkeymode, {.ui = INSERTMODE} }, ++}; ++static Command commands[] = { ++ /* modifier (4 keys) keysyms (4 keys) function argument */ ++ { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_h, 0, 0}, setlayout, {.v = &layouts[0]} }, ++ { {ControlMask, 0, 0, 0}, {XK_w, XK_o, 0, 0}, setlayout, {.v = &layouts[2]} }, ++ { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_o, 0, 0}, onlyclient, {0} }, ++ { {ControlMask, 0, 0, 0}, {XK_w, XK_v, 0, 0}, setlayout, {.v = &layouts[0]} }, ++ { {ControlMask, 0, 0, 0}, {XK_w, XK_less, 0, 0}, setmfact, {.f = -0.05} }, ++ { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_less, 0, 0}, setmfact, {.f = +0.05} }, ++ { {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_0, 0, 0}, setmfact, {.f = +1.50} }, ++ { {ShiftMask, 0, 0, 0}, {XK_period, XK_e, 0, 0}, spawn, {.v = dmenucmd} }, ++ { {ShiftMask, 0, 0, 0}, {XK_period, XK_o, 0, 0}, spawn, {.v = dmenucmd} }, ++ { {ShiftMask, 0, 0, 0}, {XK_period, XK_h, XK_Return, 0}, spawn, {.v = helpcmd} }, ++ { {ShiftMask, 0, 0, 0}, {XK_period, XK_q, XK_Return, 0}, quit, {0} }, ++ { {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_d, XK_Return}, killclient, {0} }, ++ { {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = +1} }, ++ { {ShiftMask, 0, ShiftMask, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = -1} }, ++}; ++ + /* button definitions */ + /* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ + static Button buttons[] = { +@@ -100,3 +129,5 @@ static Button buttons[] = { + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + }; + ++/* include(s) depending on the configuration variables */ ++#include "keymodes.post.h" +diff -up ../dwm-5.8.2-0/dwm.c ./dwm.c +--- ../dwm-5.8.2-0/dwm.c 2010-06-10 22:47:51.669677000 +0200 ++++ ./dwm.c 2010-06-11 00:18:55.106090000 +0200 +@@ -970,7 +970,7 @@ grabbuttons(Client *c, Bool focused) { + } + + void +-grabkeys(void) { ++grabdefkeys(void) { + updatenumlockmask(); + { + unsigned int i, j; +@@ -1052,7 +1052,7 @@ isuniquegeom(XineramaScreenInfo *unique, + #endif /* XINERAMA */ + + void +-keypress(XEvent *e) { ++defkeypress(XEvent *e) { + unsigned int i; + KeySym keysym; + XKeyEvent *ev; +diff -up ../dwm-5.8.2-0/keymodes.post.h ./keymodes.post.h +--- ../dwm-5.8.2-0/keymodes.post.h 2010-06-11 00:21:46.000000000 +0200 ++++ ./keymodes.post.h 2010-06-11 00:18:55.119222000 +0200 +@@ -0,0 +1,124 @@ ++/* See LICENSE file for copyright and license details. */ ++/* © 2010 joten */ ++ ++/* function implementations */ ++void ++clearcmd(const Arg *arg) { ++ unsigned int i; ++ ++ for(i = 0; i < LENGTH(cmdkeysym); i++) { ++ cmdkeysym[i] = 0; ++ cmdmod[i] = 0; ++ } ++} ++ ++void ++grabkeys(void) { ++ if(keymode == INSERTMODE) { ++ grabdefkeys(); ++ } else if(keymode == COMMANDMODE) { ++ XUngrabKey(dpy, AnyKey, AnyModifier, root); ++ XGrabKey(dpy, AnyKey, AnyModifier, root, ++ True, GrabModeAsync, GrabModeAsync); ++ } ++} ++ ++void ++keypress(XEvent *e) { ++ unsigned int i, j; ++ Arg a = {0}; ++ Bool ismatch = False, maybematch = False; ++ KeySym keysym; ++ XKeyEvent *ev; ++ ++ if(keymode == INSERTMODE) ++ defkeypress(e); ++ else if(keymode == COMMANDMODE) { ++ ev = &e->xkey; ++ keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); ++ if(keysym < XK_Shift_L || keysym > XK_Hyper_R) { ++ for(i = 0; i < LENGTH(cmdkeys); i++) ++ if(keysym == cmdkeys[i].keysym ++ && CLEANMASK(cmdkeys[i].mod) == CLEANMASK(ev->state) ++ && cmdkeys[i].func) { ++ cmdkeys[i].func(&(cmdkeys[i].arg)); ++ ismatch = True; ++ break; ++ } ++ if(!ismatch) { ++ for(j = 0; j < LENGTH(cmdkeysym); j++) ++ if(cmdkeysym[j] == 0) { ++ cmdkeysym[j] = keysym; ++ cmdmod[j] = ev->state; ++ break; ++ } ++ for(i = 0; i < LENGTH(commands); i++) { ++ for(j = 0; j < LENGTH(cmdkeysym); j++) { ++ if(cmdkeysym[j] == commands[i].keysym[j] ++ && CLEANMASK(cmdmod[j]) == CLEANMASK(commands[i].mod[j])) ++ ismatch = True; ++ else if(cmdkeysym[j] == 0 ++ && cmdmod[j] == 0) { ++ ismatch = False; ++ maybematch = True; ++ break; ++ } else { ++ ismatch = False; ++ break; ++ } ++ } ++ if(ismatch) { ++ if(commands[i].func) ++ commands[i].func(&(commands[i].arg)); ++ clearcmd(&a); ++ break; ++ } ++ ++ } ++ if(!maybematch) ++ clearcmd(&a); ++ } ++ } ++ } ++} ++ ++void ++onlyclient(const Arg *arg) { ++ Client *c; ++ XEvent ev; ++ ++ if(!selmon->sel) ++ return; ++ for(c = selmon->clients; c; c = c->next) ++ if(c != selmon->sel && ISVISIBLE(c)) { ++ if(isprotodel(c)) { ++ ev.type = ClientMessage; ++ ev.xclient.window = c->win; ++ ev.xclient.message_type = wmatom[WMProtocols]; ++ ev.xclient.format = 32; ++ ev.xclient.data.l[0] = wmatom[WMDelete]; ++ ev.xclient.data.l[1] = CurrentTime; ++ XSendEvent(dpy, c->win, False, NoEventMask, &ev); ++ } ++ else { ++ XGrabServer(dpy); ++ XSetErrorHandler(xerrordummy); ++ XSetCloseDownMode(dpy, DestroyAll); ++ XKillClient(dpy, c->win); ++ XSync(dpy, False); ++ XSetErrorHandler(xerror); ++ XUngrabServer(dpy); ++ } ++ } ++} ++ ++void ++setkeymode(const Arg *arg) { ++ Arg a = {0}; ++ ++ if(!arg) ++ return; ++ keymode = arg->ui; ++ clearcmd(&a); ++ grabkeys(); ++} +diff -up ../dwm-5.8.2-0/keymodes.pre.h ./keymodes.pre.h +--- ../dwm-5.8.2-0/keymodes.pre.h 2010-06-11 00:21:38.000000000 +0200 ++++ ./keymodes.pre.h 2010-06-11 00:18:55.121759000 +0200 +@@ -0,0 +1,24 @@ ++/* See LICENSE file for copyright and license details. */ ++/* © 2010 joten */ ++ ++#define COMMANDMODE 1 ++#define INSERTMODE 2 ++ ++typedef struct { ++ unsigned int mod[4]; ++ KeySym keysym[4]; ++ void (*func)(const Arg *); ++ const Arg arg; ++} Command; ++ ++/* function declarations */ ++static void clearcmd(const Arg *arg); ++static void defkeypress(XEvent *e); ++static void grabdefkeys(void); ++static void onlyclient(const Arg *arg); ++static void setkeymode(const Arg *arg); ++ ++/* variables */ ++static unsigned int cmdmod[4]; ++static unsigned int keymode = COMMANDMODE; ++static KeySym cmdkeysym[4]; diff --git a/dwm-launchers-20200527-f09418b.diff b/dwm-launchers-20200527-f09418b.diff new file mode 100644 index 0000000..a683636 --- /dev/null +++ b/dwm-launchers-20200527-f09418b.diff @@ -0,0 +1,101 @@ +From 6b5e23cdf8108a9033acc7c21c8926c0c72647fc Mon Sep 17 00:00:00 2001 +From: Adham Zahran +Date: Wed, 27 May 2020 18:07:57 +0200 +Subject: [PATCH] Top bar now has buttons that launches programs + +--- + config.def.h | 8 ++++++++ + dwm.c | 36 ++++++++++++++++++++++++++++++++++-- + 2 files changed, 42 insertions(+), 2 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..9231cd5 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -21,6 +21,14 @@ static const char *colors[][3] = { + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + ++/* launcher commands (They must be NULL terminated) */ ++static const char* surf[] = { "surf", "duckduckgo.com", NULL }; ++ ++static const Launcher launchers[] = { ++ /* command name to display */ ++ { surf, "surf" }, ++}; ++ + static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class +diff --git a/dwm.c b/dwm.c +index 9fd0286..79e7e20 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -141,6 +141,11 @@ typedef struct { + int monitor; + } Rule; + ++typedef struct { ++ const char** command; ++ const char* name; ++} Launcher; ++ + /* function declarations */ + static void applyrules(Client *c); + static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); +@@ -438,9 +443,26 @@ buttonpress(XEvent *e) + if (i < LENGTH(tags)) { + click = ClkTagBar; + arg.ui = 1 << i; +- } else if (ev->x < x + blw) ++ goto execute_handler; ++ } else if (ev->x < x + blw) { + click = ClkLtSymbol; +- else if (ev->x > selmon->ww - TEXTW(stext)) ++ goto execute_handler; ++ } ++ ++ x += blw; ++ ++ for(i = 0; i < LENGTH(launchers); i++) { ++ x += TEXTW(launchers[i].name); ++ ++ if (ev->x < x) { ++ Arg a; ++ a.v = launchers[i].command; ++ spawn(&a); ++ return; ++ } ++ } ++ ++ if (ev->x > selmon->ww - TEXTW(stext)) + click = ClkStatusText; + else + click = ClkWinTitle; +@@ -450,6 +472,9 @@ buttonpress(XEvent *e) + XAllowEvents(dpy, ReplayPointer, CurrentTime); + click = ClkClientWin; + } ++ ++execute_handler: ++ + for (i = 0; i < LENGTH(buttons); i++) + if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button + && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) +@@ -728,6 +753,13 @@ drawbar(Monitor *m) + w = blw = TEXTW(m->ltsymbol); + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); ++ ++ for (i = 0; i < LENGTH(launchers); i++) ++ { ++ w = TEXTW(launchers[i].name); ++ drw_text(drw, x, 0, w, bh, lrpad / 2, launchers[i].name, urg & 1 << i); ++ x += w; ++ } + + if ((w = m->ww - tw - x) > bh) { + if (m->sel) { +-- +2.17.1 + diff --git a/dwm-mark-new-6.2.diff b/dwm-mark-new-6.2.diff new file mode 100644 index 0000000..8d63e4d --- /dev/null +++ b/dwm-mark-new-6.2.diff @@ -0,0 +1,248 @@ +From 753860d3435e2968358f2bf8daf70bf625fe75fe Mon Sep 17 00:00:00 2001 +From: Kajetan Puchalski +Date: Mon, 5 Oct 2020 11:04:31 +0100 +Subject: [PATCH] Updated Mark patch to work with 6.2 + +--- + config.h | 14 +++++-- + drw.h | 2 +- + dwm.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 3 files changed, 118 insertions(+), 9 deletions(-) + +diff --git a/config.h b/config.h +index 3858d75..a416c97 100644 +--- a/config.h ++++ b/config.h +@@ -12,10 +12,13 @@ static const char col_gray2[] = "#444444"; + static const char col_gray3[] = "#bbbbbb"; + static const char col_gray4[] = "#eeeeee"; + static const char col_cyan[] = "#005577"; +-static const char *colors[][3] = { +- /* fg bg border */ +- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, +- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++static const char normmarkcolor[] = "#775500"; /*border color for marked client*/ ++static const char selmarkcolor[] = "#775577"; /*border color for marked client on focus*/ ++ ++static const char *colors[][4] = { ++ /* fg bg border mark */ ++ [SchemeNorm] = { col_gray3, col_gray1, col_gray2, normmarkcolor }, ++ [SchemeSel] = { col_gray4, col_cyan, col_cyan, selmarkcolor }, + }; + + /* tagging */ +@@ -94,6 +97,9 @@ static Key keys[] = { + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, ++ { MODKEY, XK_semicolon, togglemark, {0} }, ++ { MODKEY, XK_o, swapfocus, {0} }, ++ { MODKEY, XK_u, swapclient, {0} }, + }; + + /* button definitions */ +diff --git a/drw.h b/drw.h +index 4bcd5ad..97aae99 100644 +--- a/drw.h ++++ b/drw.h +@@ -12,7 +12,7 @@ typedef struct Fnt { + struct Fnt *next; + } Fnt; + +-enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ ++enum { ColFg, ColBg, ColBorder, ColMark }; /* Clr scheme index */ + typedef XftColor Clr; + + typedef struct { +diff --git a/dwm.c b/dwm.c +index 664c527..195b8eb 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -201,17 +201,21 @@ static void setclientstate(Client *c, long state); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); + static void setlayout(const Arg *arg); ++static void setmark(Client *c); + static void setmfact(const Arg *arg); + static void setup(void); + static void seturgent(Client *c, int urg); + static void showhide(Client *c); + static void sigchld(int unused); + static void spawn(const Arg *arg); ++static void swapclient(const Arg *arg); ++static void swapfocus(const Arg *arg); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); ++static void togglemark(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); +@@ -268,6 +272,7 @@ static Display *dpy; + static Drw *drw; + static Monitor *mons, *selmon; + static Window root, wmcheckwin; ++static Client *mark; + + /* configuration, allows nested code to access above variables */ + #include "config.h" +@@ -796,7 +801,10 @@ focus(Client *c) + detachstack(c); + attachstack(c); + grabbuttons(c, 1); +- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); ++ if (c == mark) ++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColMark].pixel); ++ else ++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + setfocus(c); + } else { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); +@@ -1052,7 +1060,10 @@ manage(Window w, XWindowAttributes *wa) + + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); +- XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); ++ if (c == mark) ++ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColMark].pixel); ++ else ++ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); + configure(c); /* propagates border_width, if size doesn't change */ + updatewindowtype(c); + updatesizehints(c); +@@ -1512,6 +1523,23 @@ setlayout(const Arg *arg) + drawbar(selmon); + } + ++void ++setmark(Client *c) ++{ ++ if (c == mark) ++ return; ++ if (mark) { ++ XSetWindowBorder(dpy, mark->win, scheme[mark == selmon->sel ++ ? SchemeSel : SchemeNorm][ColBorder].pixel); ++ mark = 0; ++ } ++ if (c) { ++ XSetWindowBorder(dpy, c->win, scheme[c == selmon->sel ++ ? SchemeSel : SchemeNorm][ColMark].pixel); ++ mark = c; ++ } ++} ++ + /* arg > 1.0 will set mfact absolutely */ + void + setmfact(const Arg *arg) +@@ -1570,7 +1598,7 @@ setup(void) + /* init appearance */ + scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); + for (i = 0; i < LENGTH(colors); i++) +- scheme[i] = drw_scm_create(drw, colors[i], 3); ++ scheme[i] = drw_scm_create(drw, colors[i], 4); + /* init bars */ + updatebars(); + updatestatus(); +@@ -1653,6 +1681,75 @@ spawn(const Arg *arg) + } + } + ++void ++swapclient(const Arg *arg) ++{ ++ Client *s, *m, t; ++ ++ if (!mark || !selmon->sel || mark == selmon->sel ++ || !selmon->lt[selmon->sellt]->arrange) ++ return; ++ s = selmon->sel; ++ m = mark; ++ t = *s; ++ strcpy(s->name, m->name); ++ s->win = m->win; ++ s->x = m->x; ++ s->y = m->y; ++ s->w = m->w; ++ s->h = m->h; ++ ++ m->win = t.win; ++ strcpy(m->name, t.name); ++ m->x = t.x; ++ m->y = t.y; ++ m->w = t.w; ++ m->h = t.h; ++ ++ selmon->sel = m; ++ mark = s; ++ focus(s); ++ setmark(m); ++ ++ arrange(s->mon); ++ if (s->mon != m->mon) { ++ arrange(m->mon); ++ } ++} ++ ++void ++swapfocus(const Arg *arg) ++{ ++ Client *t; ++ ++ if (!selmon->sel || !mark || selmon->sel == mark) ++ return; ++ t = selmon->sel; ++ if (mark->mon != selmon) { ++ unfocus(selmon->sel, 0); ++ selmon = mark->mon; ++ } ++ if (ISVISIBLE(mark)) { ++ focus(mark); ++ restack(selmon); ++ } else { ++ selmon->seltags ^= 1; ++ selmon->tagset[selmon->seltags] = mark->tags; ++ focus(mark); ++ arrange(selmon); ++ } ++ setmark(t); ++} ++ ++void ++togglemark(const Arg *arg) ++{ ++ if (!selmon->sel) ++ return; ++ setmark(selmon->sel == mark ? 0 : selmon->sel); ++} ++ ++ + void + tag(const Arg *arg) + { +@@ -1755,7 +1852,10 @@ unfocus(Client *c, int setfocus) + if (!c) + return; + grabbuttons(c, 0); +- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); ++ if (c == mark) ++ XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColMark].pixel); ++ else ++ XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); + if (setfocus) { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); +@@ -1768,6 +1868,9 @@ unmanage(Client *c, int destroyed) + Monitor *m = c->mon; + XWindowChanges wc; + ++ if (c == mark) ++ setmark(0); ++ + detach(c); + detachstack(c); + if (!destroyed) { +-- +2.28.0 + diff --git a/dwm-nrowgrid-6.1.diff b/dwm-nrowgrid-6.1.diff new file mode 100644 index 0000000..e2e6505 --- /dev/null +++ b/dwm-nrowgrid-6.1.diff @@ -0,0 +1,77 @@ +Author: Chris Noxz + +diff -upN dwm-6.1/config.def.h dwm-nrowgrid-6.1/config.def.h +--- dwm-6.1/config.def.h 2015-11-08 23:11:48.000000000 +0100 ++++ dwm-nrowgrid-6.1/config.def.h 2018-10-01 10:44:05.631382842 +0200 +@@ -34,11 +34,15 @@ static const float mfact = 0.55; /* + static const int nmaster = 1; /* number of clients in master area */ + static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + ++#define FORCE_VSPLIT 1 ++#include "nrowgrid.c" ++ + static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "###", nrowgrid }, + }; + + /* key definitions */ +diff -upN dwm-6.1/nrowgrid.c dwm-nrowgrid-6.1/nrowgrid.c +--- dwm-6.1/nrowgrid.c 1970-01-01 01:00:00.000000000 +0100 ++++ dwm-nrowgrid-6.1/nrowgrid.c 2018-10-01 10:44:27.741263063 +0200 +@@ -0,0 +1,52 @@ ++void ++nrowgrid(Monitor *m) ++{ ++ unsigned int n = 0, i = 0, ri = 0, ci = 0; /* counters */ ++ unsigned int cx, cy, cw, ch; /* client geometry */ ++ unsigned int uw = 0, uh = 0, uc = 0; /* utilization trackers */ ++ unsigned int cols, rows = m->nmaster + 1; ++ Client *c; ++ ++ /* count clients */ ++ for (c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ ++ /* nothing to do here */ ++ if (n == 0) ++ return; ++ ++ /* force 2 clients to always split vertically */ ++ if (FORCE_VSPLIT && n == 2) ++ rows = 1; ++ ++ /* never allow empty rows */ ++ if (n < rows) ++ rows = n; ++ ++ /* define first row */ ++ cols = n / rows; ++ uc = cols; ++ cy = m->wy; ++ ch = m->wh / rows; ++ uh = ch; ++ ++ for (c = nexttiled(m->clients); c; c = nexttiled(c->next), i++, ci++) { ++ if (ci == cols) { ++ uw = 0; ++ ci = 0; ++ ri++; ++ ++ /* next row */ ++ cols = (n - uc) / (rows - ri); ++ uc += cols; ++ cy = m->wy + uh; ++ ch = (m->wh - uh) / (rows - ri); ++ uh += ch; ++ } ++ ++ cx = m->wx + uw; ++ cw = (m->ww - uw) / (cols - ci); ++ uw += cw; ++ ++ resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, 0); ++ } ++}