From 872293bfb7007e855ed4d56b8d0854c7da1650e4 Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Tue, 17 Jul 2018 23:38:46 +0200 Subject: [PATCH] Add current state of my dwm config --- ...support-for-_NET_SUPPORTING_WM_CHECK.patch | 45 +++++++++++++ 0002-add-support-for-columns-layout.patch | 63 +++++++++++++++++++ PKGBUILD | 14 +++-- config.h | 23 +++---- 4 files changed, 128 insertions(+), 17 deletions(-) create mode 100644 0001-add-support-for-_NET_SUPPORTING_WM_CHECK.patch create mode 100644 0002-add-support-for-columns-layout.patch diff --git a/0001-add-support-for-_NET_SUPPORTING_WM_CHECK.patch b/0001-add-support-for-_NET_SUPPORTING_WM_CHECK.patch new file mode 100644 index 0000000..53d4933 --- /dev/null +++ b/0001-add-support-for-_NET_SUPPORTING_WM_CHECK.patch @@ -0,0 +1,45 @@ +/* https://bbs.archlinux.org/viewtopic.php?pid=1635677#p1635677 */ +diff --git a/dwm.c b/dwm.c +index ff7e096..454fb36 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -60,7 +60,7 @@ + /* enums */ + enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ + enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */ +-enum { NetSupported, NetWMName, NetWMState, ++enum { NetSupported, NetWMName, NetWMState, NetSupportingWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ + enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ +@@ -490,6 +490,7 @@ cleanup(void) + XSync(dpy, False); + XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); ++ XDeleteProperty(dpy, root, netatom[NetSupportingWMCheck]); + } + + void +@@ -1574,6 +1575,7 @@ setup(void) + wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False); + netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); + netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); ++ netatom[NetSupportingWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); + netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); + netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); + netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); +@@ -1598,6 +1600,14 @@ setup(void) + XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, + PropModeReplace, (unsigned char *) netatom, NetLast); + XDeleteProperty(dpy, root, netatom[NetClientList]); ++ /* EWMH support for _NET_SUPPORTING_WM_CHECK */ ++ XChangeProperty(dpy, root, netatom[NetSupportingWMCheck], XA_WINDOW, ++ 32, PropModeReplace, (unsigned char *)&mons->barwin, 1); ++ XChangeProperty(dpy, mons->barwin, netatom[NetSupportingWMCheck], XA_WINDOW, ++ 32, PropModeReplace, (unsigned char *)&mons->barwin, 1); ++ XChangeProperty(dpy, mons->barwin, netatom[NetWMName], ++ XInternAtom(dpy, "UTF8_STRING", False), 8, ++ PropModeReplace, (unsigned char *)"dwm", strlen("dwm")); + /* select for events */ + wa.cursor = cursor[CurNormal]->cursor; + wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|PointerMotionMask diff --git a/0002-add-support-for-columns-layout.patch b/0002-add-support-for-columns-layout.patch new file mode 100644 index 0000000..cfcc43f --- /dev/null +++ b/0002-add-support-for-columns-layout.patch @@ -0,0 +1,63 @@ +/* https://dwm.suckless.org/patches/columns/ */ +--- dwm.c.orig 2015-11-08 23:39:37.000000000 +0100 ++++ dwm.c 2018-07-17 23:21:18.248885244 +0200 +@@ -154,6 +154,7 @@ + static void cleanupmon(Monitor *mon); + static void clearurgent(Client *c); + static void clientmessage(XEvent *e); ++static void col(Monitor *); + static void configure(Client *c); + static void configurenotify(XEvent *e); + static void configurerequest(XEvent *e); +@@ -542,6 +543,33 @@ + } + } + ++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), False); ++ 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), False); ++ y += HEIGHT(c); ++ } ++ } ++} ++ + void + configure(Client *c) + { +--- config.def.h.orig 2015-11-08 23:39:37.000000000 +0100 ++++ config.def.h 2018-07-17 23:18:34.688205413 +0200 +@@ -39,6 +39,7 @@ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "|||", col }, + }; + + /* key definitions */ +@@ -74,6 +75,7 @@ + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, ++ { MODKEY, XK_c, setlayout, {.v = &layouts[3]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, diff --git a/PKGBUILD b/PKGBUILD index bb62ff3..7e8d361 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -11,18 +11,24 @@ url="http://dwm.suckless.org" arch=('i686' 'x86_64') license=('MIT') options=(zipman) -depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'st' 'dmenu') +depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'rxvt-unicode' 'dmenu') install=dwm.install source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz config.h - dwm.desktop) + dwm.desktop + 0001-add-support-for-_NET_SUPPORTING_WM_CHECK.patch + 0002-add-support-for-columns-layout.patch) md5sums=('f0b6b1093b7207f89c2a90b848c008ec' - '80c4ef2a3eca0fe2d14e2203e3833200' - '939f403a71b6e85261d09fc3412269ee') + '54ada53aca72a68833dbdcc4e0d7c864' + '939f403a71b6e85261d09fc3412269ee' + '2491115ff8327a4526a3361228071bc2' + '33569a6627811e3de3185753a23db5f8') prepare() { cd $srcdir/$pkgname-$pkgver cp $srcdir/config.h config.h + patch -p1 -i $srcdir/0001-add-support-for-_NET_SUPPORTING_WM_CHECK.patch + patch -p0 -i $srcdir/0002-add-support-for-columns-layout.patch } build() { diff --git a/config.h b/config.h index 7054c06..f079f23 100644 --- a/config.h +++ b/config.h @@ -19,20 +19,12 @@ static const int topbar = 1; /* 0 means bottom bar */ /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; -static const Rule rules[] = { - /* xprop(1): - * WM_CLASS(STRING) = instance, class - * WM_NAME(STRING) = title - */ - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, 1, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, -}; +static const Rule rules[] = { NULL }; /* layout(s) */ -static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */ static const int nmaster = 1; /* number of clients in master area */ -static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ +static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ static const Layout layouts[] = { /* symbol arrange function */ @@ -42,7 +34,7 @@ static const Layout layouts[] = { }; /* key definitions */ -#define MODKEY Mod1Mask +#define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ @@ -55,7 +47,9 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; -static const char *termcmd[] = { "st", NULL }; +static const char *termcmd[] = { "urxvt", NULL }; +static const char *lockcmd[] = { "physlock", "-m", NULL }; +static const char *scrot[] = { "scrot", "/home/alex/Pictures/Screenshots/%Y-%m-%d-%H%M%S_$wx$h.png", NULL }; static Key keys[] = { /* modifier key function argument */ @@ -92,6 +86,9 @@ static Key keys[] = { TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_l, spawn, {.v = lockcmd } }, + { 0, XK_Print, spawn, {.v = scrot } }, + { ShiftMask, XK_Print, spawn, SHCMD("sleep 0.2; scrot -s '/home/alex/Pictures/Screenshots/%Y-%m-%d-%H%M%S_$wx$h.png'") }, }; /* button definitions */