Re: [hackers] About swapfocus dwm patch
Hi Vinícius, sorry for the inconveniences. I have added a view features to the swapfocus patch, because I did not like the default behavior of it. Though I'm not using this patch any more and for that reason I won't fix the patch. If it is really not working I will remove the recent swapfocus patch from the wiki. I'm using now the stacker patch instead. It also provides the features swapfocus provided as well as some other useful stuff. Imho the stacker patch is also a lot cleaner. I would recommend you to either try an older version of swapfocus or the stacker patch instead. Sorry and kind regards, Aaron Am 30. September 2020 04:58:01 MESZ schrieb "vinícius mota" : >Thank you very much Chris for your reply. > >I just tried again, from scratch, and failed again, with the same >error. >Early on today I successfully installed other suckless patches, this >time >for st, following the same procedure and everything worked flawlessly. >In >fact since I have two other patches for dwm in place, everytime dwm is >reinstalled those two patches are reinstalled as well, and that >happened >several times today. > >It may be nonsense but I have looked up several patches' codes today >and >noticed that the beginning of the swapfocus patch is different, with a >different "diff" command: > >diff -up a/config.def.h b/config.def.h >--- a/config.def.h 2020-01-29 00:06:12.415681126 +0100 >+++ b/config.def.h 2020-01-29 13:25:14.167910093 +0100 >@@ -66,6 +66,7 > >while for all others that I have looked in such as hide vacant tags the >diff command reads > >diff --git a/dwm.c b/dwm.c >index 4465af1..c4aa3de 100644 >--- a/dwm.c >+++ b/dwm.c >@@ -416,7 +416,7 @@ > >Other than that I have no idea of why it is failing the way it is. > >Anyway, thank you again very much for your reply. > >Vinícius. > > > > >-- >Fingerprint: 1224546E7D5435465E1777CB8E65EA37669D90BE >Long Key ID: >8E65EA37669D90BE >Short Key ID: > 669D90BE > > >On Tue, Sep 29, 2020 at 10:29 PM Chris Down >wrote: > >> Hi Vinícius, >> >> The error message from patch is quite clear that it failed to apply, >so >> compilation is premature. You need to either massage it in, or find a >> patch >> which roughly matches your version. >> >>
[hackers][dwm][PATCH] New implementation of the pertag patch
I changed the pertag patch, so that changes apply to all selected tags. For example: If tag 2 and tag 3 are selected and mfact is changed, the changes will apply to both of these tags. With the original pertag patch changes only apply to the tag selected first. diff -up a/dwm.c b/dwm.c --- a/dwm.c 2020-04-17 13:37:50.926942626 +0200 +++ b/dwm.c 2020-04-17 13:44:30.578373509 +0200 @@ -111,6 +111,7 @@ typedef struct { void (*arrange)(Monitor *); } Layout; +typedef struct Pertag Pertag; struct Monitor { char ltsymbol[16]; float mfact; @@ -130,6 +131,7 @@ struct Monitor { Monitor *next; Window barwin; const Layout *lt[2]; + Pertag *pertag; }; typedef struct { @@ -271,6 +273,15 @@ static Window root, wmcheckwin; /* configuration, allows nested code to access above variables */ #include "config.h" +struct Pertag { + unsigned int curtag, prevtag; /* current and previous tag */ + int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ + float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */ + unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */ + const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */ + int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ +}; + /* compile-time check if all tags fit into an unsigned int bit array. */ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; @@ -631,6 +642,7 @@ Monitor * createmon(void) { Monitor *m; + unsigned int i; m = ecalloc(1, sizeof(Monitor)); m->tagset[0] = m->tagset[1] = 1; @@ -641,6 +653,20 @@ createmon(void) m->lt[0] = [0]; m->lt[1] = [1 % LENGTH(layouts)]; strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); + m->pertag = ecalloc(1, sizeof(Pertag)); + m->pertag->curtag = m->pertag->prevtag = 1; + + for (i = 0; i <= LENGTH(tags); i++) { + m->pertag->nmasters[i] = m->nmaster; + m->pertag->mfacts[i] = m->mfact; + + m->pertag->ltidxs[i][0] = m->lt[0]; + m->pertag->ltidxs[i][1] = m->lt[1]; + m->pertag->sellts[i] = m->sellt; + + m->pertag->showbars[i] = m->showbar; + } + return m; } @@ -966,7 +992,11 @@ grabkeys(void) void incnmaster(const Arg *arg) { + unsigned int i; selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); + for(i=0; i<=LENGTH(tags); ++i) + if(selmon->tagset[selmon->seltags] & 1nmasters[(i+1)%LENGTH(tags)] = selmon->nmaster; arrange(selmon); } @@ -1500,11 +1530,20 @@ setfullscreen(Client *c, int fullscreen) void setlayout(const Arg *arg) { + unsigned int i; if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) selmon->sellt ^= 1; if (arg && arg->v) selmon->lt[selmon->sellt] = (Layout *)arg->v; strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); + + for(i=0; i<=LENGTH(tags); ++i) + if(selmon->tagset[selmon->seltags] & 1 ltidxs[(i+1)%LENGTH(tags)][selmon->sellt] = selmon->lt[selmon->sellt]; + selmon->pertag->sellts[(i+1)%LENGTH(tags)] = selmon->sellt; + } + if (selmon->sel) arrange(selmon); else @@ -1516,13 +1555,19 @@ void setmfact(const Arg *arg) { float f; + unsigned int i; if (!arg || !selmon->lt[selmon->sellt]->arrange) return; f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; + if (arg->f == 0.0) + f = mfact; if (f < 0.1 || f > 0.9) return; selmon->mfact = f; + for(i=0; i<=LENGTH(tags); ++i) + if(selmon->tagset[selmon->seltags] & 1 mfacts[(i+1)%LENGTH(tags)] = f; arrange(selmon); } @@ -1699,7 +1744,11 @@ tile(Monitor *m) void togglebar(const Arg *arg) { + unsigned int i; selmon->showbar = !selmon->showbar; + for(i=0; i<=LENGTH(tags); ++i) + if(selmon->tagset[selmon->seltags] & 1 showbars[(i+1)%LENGTH(tags)] = selmon->showbar; updatebarpos(selmon); XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); arrange(selmon); @@ -1738,9 +1787,33 @@ void toggleview(const Arg *arg) { unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); + int i; if (newtagset) { selmon->tagset[selmon->seltags] = newtagset; + + if (newtagset == ~0) { + selmon->pertag->prevtag = selmon->pertag->curtag; + selmon->pertag->curtag = 0; + } + + /* test if the user did not select the same tag */ + if (!(newtagset & 1 <<
[hackers] [dwm] [PATCH] layouts added to fullgaps patch
Hi all, I just edited the layouts gaplesgrid, bstack, bstackhoriz, fibonacci(spiral, dwindle), centeredfloatingmaster, centeredfloatingmaster to work with fullgaps. Gaps are removed when only one client is visible. If it is used in combination with the noborders patch, this patch results in a similar behaviour as the uselessgap patch, but with keybindings to change gaps during runtime. --- config.def.h | 29 ++- dwm.c | 223 -- fibonacci.c | 71 gaplessgrid.c | 40 + 4 files changed, 351 insertions(+), 12 deletions(-) create mode 100644 fibonacci.c create mode 100644 gaplessgrid.c diff --git a/config.def.h b/config.def.h index 1c0b587..7672129 100644 --- a/config.def.h +++ b/config.def.h @@ -2,6 +2,7 @@ /* appearance */ static const unsigned int borderpx = 1;/* border pixel of windows */ +static const unsigned int gappx = 5;/* gaps between windows */ 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 */ @@ -36,11 +37,21 @@ 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 */ +#include "fibonacci.c" +#include "gaplessgrid.c" static const Layout layouts[] = { /* symbol arrange function */ - { "[]=", tile },/* first entry is default */ - { "><>", NULL },/* no layout function means floating behavior */ + { "[]=", tile }, /* first entry is default */ + { "###", gaplessgrid }, + { "[@]", spiral }, + { "[\\]", dwindle }, + { "|M|", centeredmaster }, + { ">M>", centeredfloatingmaster }, + { "TTT", bstack }, + { "===", bstackhoriz }, { "[M]", monocle }, + { "><>", NULL },/* no layout function means floating behavior */ + { NULL, NULL }, }; /* key definitions */ @@ -74,8 +85,15 @@ static Key keys[] = { { MODKEY, XK_Tab,view, {0} }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY, XK_t, setlayout, {.v = [0]} }, - { MODKEY, XK_f, setlayout, {.v = [1]} }, - { MODKEY, XK_m, setlayout, {.v = [2]} }, + { MODKEY, XK_g, setlayout, {.v = [1]} }, + { MODKEY, XK_q, setlayout, {.v = [2]} }, + { MODKEY, XK_a, setlayout, {.v = [3]} }, + { MODKEY, XK_u, setlayout, {.v = [4]} }, + { MODKEY, XK_o, setlayout, {.v = [5]} }, + { MODKEY, XK_x, setlayout, {.v = [6]} }, + { MODKEY, XK_y, setlayout, {.v = [7]} }, + { MODKEY, XK_m, setlayout, {.v = [8]} }, + { MODKEY, XK_f, setlayout, {.v = [9]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, @@ -84,6 +102,9 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { MODKEY, XK_minus, setgaps,{.i = -1 } }, + { MODKEY, XK_equal, setgaps,{.i = +1 } }, + { MODKEY|ShiftMask, XK_equal, setgaps,{.i = 0 } }, TAGKEYS(XK_1, 0) TAGKEYS(XK_2, 1) TAGKEYS(XK_3, 2) diff --git a/dwm.c b/dwm.c index 4465af1..9f06978 100644 --- a/dwm.c +++ b/dwm.c @@ -119,6 +119,7 @@ struct Monitor { int by; /* bar geometry */ int mx, my, mw, mh; /* screen size */ int wx, wy, ww, wh; /* window area */ + int gappx;/* gaps between windows */ unsigned int seltags; unsigned int sellt; unsigned int tagset[2]; @@ -199,6 +200,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);