bakkeby / patches

Collection of patches for dwm, st and dmenu
286 stars 30 forks source link

Vanity Gaps Incompatable With DWM Version 6.4 #72

Closed VehementHam closed 1 year ago

VehementHam commented 1 year ago

For the vanity gaps patch, the latest is only version 6.3. Could you please update it to 6.4? Thank you.

I have tried to patch the older version, but the reject file references parts of the dwm.c that do not exist and make fails.

bakkeby commented 1 year ago

Actually this is the same conflict with the signature change of

static void tile(Monitor *);

to

static void tile(Monitor *m);

git apply -3 should usually work (although leaves the conflict changes inline).

I'll add the 6.4 ports in any case.

bakkeby commented 1 year ago

Added links under https://github.com/bakkeby/patches/wiki/vanitygaps

VehementHam commented 1 year ago

I don't undersand what the right way to deal with this vanity gaps/flextile delux conflict:

.rej file:

 static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */

+#define FORCE_VSPLIT 1  /* nrowgrid layout: force two clients to always split vertically */
+#include "vanitygaps.c"
+
 static const Layout layouts[] = {
    /* symbol     arrange function */
    { "[]=",      tile },    /* first entry is default */
-   { "><>",      NULL },    /* no layout function means floating behavior */
    { "[M]",      monocle },
+   { "[@]",      spiral },
+   { "[\\]",     dwindle },
+   { "D[]",      deck },
+   { "TTT",      bstack },
+   { "===",      bstackhoriz },
+   { "HHH",      grid },
+   { "###",      nrowgrid },
+   { "---",      horizgrid },
+   { ":::",      gaplessgrid },
+   { "|M|",      centeredmaster },
+   { ">M>",      centeredfloatingmaster },
+   { "><>",      NULL },    /* no layout function means floating behavior */
+   { NULL,       NULL },
 };

 /* key definitions */

Here is the section of the config.h:

static const Layout layouts[] = {
    /* symbol     arrange function, { nmaster, nstack, layout, master axis, stack axis, secondary stack axis } */
    { "[]=",      flextile,         { -1, -1, SPLIT_VERTICAL, TOP_TO_BOTTOM, TOP_TO_BOTTOM, 0, NULL } }, // default tile layout
    { "><>",      NULL,             {0} },    /* no layout function means floating behavior */
    { "[M]",      flextile,         { -1, -1, NO_SPLIT, MONOCLE, MONOCLE, 0, NULL } }, // monocle
    { "|||",      flextile,         { -1, -1, SPLIT_VERTICAL, LEFT_TO_RIGHT, TOP_TO_BOTTOM, 0, NULL } }, // columns (col) layout
    { ">M>",      flextile,         { -1, -1, FLOATING_MASTER, LEFT_TO_RIGHT, LEFT_TO_RIGHT, 0, NULL } }, // floating master
    { "[D]",      flextile,         { -1, -1, SPLIT_VERTICAL, TOP_TO_BOTTOM, MONOCLE, 0, NULL } }, // deck
    { "TTT",      flextile,         { -1, -1, SPLIT_HORIZONTAL, LEFT_TO_RIGHT, LEFT_TO_RIGHT, 0, NULL } }, // bstack
    { "===",      flextile,         { -1, -1, SPLIT_HORIZONTAL, LEFT_TO_RIGHT, TOP_TO_BOTTOM, 0, NULL } }, // bstackhoriz
    { "|M|",      flextile,         { -1, -1, SPLIT_HORIZONTAL, LEFT_TO_RIGHT, TOP_TO_BOTTOM, 0, monoclesymbols } }, // centeredmaster
    { ":::",      flextile,         { -1, -1, NO_SPLIT, GAPPLESSGRID, GAPPLESSGRID, 0, NULL } }, // gappless grid
    { "[\\]",     flextile,         { -1, -1, NO_SPLIT, DWINDLE, DWINDLE, 0, NULL } }, // fibonacci dwindle
    { "(@)",      flextile,         { -1, -1, NO_SPLIT, SPIRAL, SPIRAL, 0, NULL } }, // fibonacci spiral
    { "[T]",      flextile,         { -1, -1, SPLIT_VERTICAL, LEFT_TO_RIGHT, TATAMI, 0, NULL } }, // tatami mats
};
VehementHam commented 1 year ago

It also wants me to remove this line from the dwm.c, but the line does not exist.

static void tile(Monitor *m);
VehementHam commented 1 year ago

I made my best efforts to follow what the reject files said to do. When compiling I recieved these errors:

./config.h:60:16: error: use of undeclared identifier 'spiral'
        { "[@]",      spiral },
                      ^
./config.h:61:17: error: use of undeclared identifier 'dwindle'
        { "[\\]",     dwindle },
                      ^
./config.h:62:17: error: use of undeclared identifier 'deck'
        { "D[]",      deck },
                      ^
./config.h:63:17: error: use of undeclared identifier 'bstack'; did you mean 'nstack'?
        { "TTT",      bstack },
                      ^~~~~~
                      nstack
./config.h:42:18: note: 'nstack' declared here
static const int nstack      = 0;    /* number of clients in primary stack area */
                 ^
./config.h:64:17: error: use of undeclared identifier 'bstackhoriz'
        { "===",      bstackhoriz },
                      ^
./config.h:65:17: error: use of undeclared identifier 'grid'
        { "HHH",      grid },
                      ^
./config.h:66:17: error: use of undeclared identifier 'nrowgrid'
        { "###",      nrowgrid },
                      ^
./config.h:67:17: error: use of undeclared identifier 'horizgrid'
        { "---",      horizgrid },
                      ^
./config.h:68:16: error: use of undeclared identifier 'gaplessgrid'
        { ":::",      gaplessgrid },
                      ^
./config.h:69:17: error: use of undeclared identifier 'centeredmaster'
        { "|M|",      centeredmaster },
                      ^
./config.h:70:17: error: use of undeclared identifier 'centeredfloatingmaster'
        { ">M>",      centeredfloatingmaster },
                      ^
./config.h:108:45: error: use of undeclared identifier 'incrgaps'
        { MODKEY|Mod4Mask,              XK_u,      incrgaps,       {.i = +1 } },
                                                   ^
./config.h:109:45: error: use of undeclared identifier 'incrgaps'
        { MODKEY|Mod4Mask|ShiftMask,    XK_u,      incrgaps,       {.i = -1 } },
                                                   ^
./config.h:110:45: error: use of undeclared identifier 'incrigaps'
        { MODKEY|Mod4Mask,              XK_i,      incrigaps,      {.i = +1 } },
                                                   ^
./config.h:111:45: error: use of undeclared identifier 'incrigaps'
        { MODKEY|Mod4Mask|ShiftMask,    XK_i,      incrigaps,      {.i = -1 } },
                                                   ^
./config.h:112:45: error: use of undeclared identifier 'incrogaps'
        { MODKEY|Mod4Mask,              XK_o,      incrogaps,      {.i = +1 } },
                                                   ^
./config.h:113:45: error: use of undeclared identifier 'incrogaps'
        { MODKEY|Mod4Mask|ShiftMask,    XK_o,      incrogaps,      {.i = -1 } },
                                                   ^
./config.h:114:45: error: use of undeclared identifier 'incrihgaps'
        { MODKEY|Mod4Mask,              XK_6,      incrihgaps,     {.i = +1 } },
                                                   ^
./config.h:115:45: error: use of undeclared identifier 'incrihgaps'
        { MODKEY|Mod4Mask|ShiftMask,    XK_6,      incrihgaps,     {.i = -1 } },
                                                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
*** Error 1 in /home/vehementham/Git/dwm (Makefile:25 'dwm.o')

I remved the lines that it was complaining about, and it recompiled sucessfully. Upon restarting the WM, the gaps were not visable.

bakkeby commented 1 year ago

It is generally better to do a three way merge using git (git apply -3 <patch.file>) than using patch because git in this context can take advantage of the git history of the repository while patch just works on the plain difference between the source and the .diff file.

It is not a miracle worker but it sometimes get around minor conflicts that has nothing to do with changes in the patch file.

Committing changes after each patch should help in this respect as well.

You don't actually learn anything from applying patches using either of these tools though. If you want to get the most out of dwm then I would recommend applying patches by hand; as in reading the patch file and copying in the changes manually. This is tedious and time consuming, but you get a better feel for the code base and what is being changed to get a certain behaviour.

Ultimately it puts you in a much better position when it comes down to sorting out conflicts; and the chance of conflicts occurring increase with every patch you apply.

bakkeby commented 1 year ago

As for the undeclared identifiers referring to bstack, spiral etc. maybe you dropped the include line that imports vanitygaps.c.

You don't actually need any changes to the layouts array as you are using flextile-deluxe, so you can just delete the individual layouts in that vanitygaps file unless you want to keep them for testing purposes.

VehementHam commented 1 year ago

You are right. I did forget to add the line that includes the vanity gaps Patch. I was able to recompile. When I re-enter DWM, the gaps do not show up.

bakkeby commented 1 year ago

Yes that would be because you have not integrated vanitygaps with flextile-deluxe.

Search for "VANITYGAPS_PATCH" in the flextile -deluxe.c file and you should find an #if, #else and #endif section.

This is an if statement that takes place during compile time and as VANITYGAPS_PATCH is not defined the if statement will evaluate to false. This is an integration hint that I left in the patch and the intention is that you remove the code that you don't need manually.

Alternatively you can add this at the top of dwm.c.

#define VANITYGAPS_PATCH 1

or it would be possible to pass this in the Makefile when building dwm.

VehementHam commented 1 year ago

Thank you so much, that worked.