dwm

my heavily-patched and customized dwm build
git clone git://git.kocotian.pl/dwm.git
Log | Files | Refs | README | LICENSE

commit 8920377a09b8161227cb1e8d866643109c20d683
parent 56fed4f66501102eace0f20ec73e44456542c88b
Author: kocotian <kocotian@kocotian.pl>
Date:   Sat, 12 Dec 2020 13:05:32 +0100

attaching, changes

Diffstat:
Mconfig.def.h | 19+++++++++++++++----
Ddrw.o | 0
Ddwm | 0
Mdwm.c | 40+++++++++++++++++++++++++++++++++++++---
Ddwm.o | 0
Dutil.o | 0
6 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -6,6 +6,7 @@ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const int barheight = 25; /* height of a bar; 0 equals autocalculation */ +static const char attachdirection = 0; /* 0 default, 1 above, 2 aside, 3 below, 4 bottom, 5 top */ static const char *fonts[] = { "monospace:size=8" }; static const char dmenufont[] = "monospace:size=8"; static const char col_gray1[] = "#222222"; @@ -42,10 +43,9 @@ static const Rule rules[] = { }; /* layout(s) */ -static const float mfact = 0.55; /* 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 attachdirection = 0; /* 0 default, 1 above, 2 aside, 3 below, 4 bottom, 5 top */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ static const Layout layouts[] = { /* symbol arrange function */ @@ -58,6 +58,16 @@ static const Layout layouts[] = { { "><>", NULL }, /* no layout function means floating behavior */ }; +static const Direction directions[] = { + /* symbol arrange function */ + { "-<-", attach }, /* first entry is default */ + { "-^-", attachabove }, + { "->-", attachaside }, + { "-v-", attachbelow }, + { "vvv", attachbottom }, + { "^^^", attachtop }, +}; + /* key definitions */ #define MODKEY Mod4Mask /* WinKey; Change to Mod1Mask if you want AltKey as Modifier */ #define TAGKEYS(KEY,TAG) \ @@ -98,6 +108,7 @@ static Key keys[] = { { MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_z, setlayout, {0} }, + { MODKEY, XK_x, setattach, {0} }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, diff --git a/drw.o b/drw.o Binary files differ. diff --git a/dwm b/dwm Binary files differ. diff --git a/dwm.c b/dwm.c @@ -113,8 +113,15 @@ typedef struct { void (*arrange)(Monitor *); } Layout; +typedef struct { + const char *symbol; + void (*direction)(Client *); +} Direction; + struct Monitor { char ltsymbol[16]; + char attsymbol[16]; + char attachdirection; float mfact; int nmaster; int num; @@ -212,6 +219,7 @@ static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); +static void setattach(const Arg *arg); static void setlayout(const Arg *arg); static void setcfact(const Arg *arg); static void setmfact(const Arg *arg); @@ -411,6 +419,7 @@ arrange(Monitor *m) void arrangemon(Monitor *m) { + strncpy(m->attsymbol, directions[m->attachdirection].symbol, sizeof directions[m->attachdirection].symbol); strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); if (m->lt[m->sellt]->arrange) m->lt[m->sellt]->arrange(m); @@ -458,7 +467,7 @@ attachbelow(Client *c) c->next = c->mon->sel->next; c->mon->sel->next = c; } - + void attachbottom(Client *c) { @@ -718,6 +727,7 @@ createmon(void) m = ecalloc(1, sizeof(Monitor)); m->tagset[0] = m->tagset[1] = 1; + m->attachdirection = attachdirection; m->mfact = mfact; m->nmaster = nmaster; m->showbar = showbar; @@ -725,6 +735,7 @@ createmon(void) m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); + strncpy(m->attsymbol, directions[0].symbol, sizeof directions[0].symbol); return m; } @@ -788,7 +799,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[SchemeStatus]); - tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ + tw = TEXTW(stext) - lrpad + 6 + 2; /* 8px right padding */ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); } @@ -808,10 +819,18 @@ drawbar(Monitor *m) urg & 1 << i); x += w; } + + /* Here you can add "modules" to + barwin, after ltsymbol */ + w = blw = TEXTW(m->ltsymbol); drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + w = blw = TEXTW(m->attsymbol); + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->attsymbol, 0); + if ((w = m->ww - tw - x) > bh) { if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]); @@ -1147,7 +1166,9 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); - switch(attachdirection){ + directions[selmon->attachdirection].direction(c); + /* + switch (selmon->attachdirection){ case 1: attachabove(c); break; @@ -1166,6 +1187,7 @@ manage(Window w, XWindowAttributes *wa) default: attach(c); } + */ attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &(c->win), 1); @@ -1630,6 +1652,18 @@ setfullscreen(Client *c, int fullscreen) } void +setattach(const Arg *arg) +{ + if (selmon->attachdirection < 5) + selmon->attachdirection++; + else selmon->attachdirection = 0; + if (selmon->sel) + arrange(selmon); + else + drawbar(selmon); +} + +void setlayout(const Arg *arg) { if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) diff --git a/dwm.o b/dwm.o Binary files differ. diff --git a/util.o b/util.o Binary files differ.