dwm

my build of dwm
git clone git://popovic.xyz/dwm.git
Log | Files | Refs | README | LICENSE

commit 5c0d692acee66213496e5ab03079a63dfdd2e743
parent bfb439c48b17c742f685556f3250bd6f05d6634b
Author: miksa <milutin@popovic.xyz>
Date:   Tue, 27 Apr 2021 21:06:07 +0200

fixed dwm-bar by applying patches correctly

Diffstat:
Mconfig.def.h | 162++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mconfig.h | 162++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mdwm | 0
Mdwm.c | 36++++++++++++++++++++++--------------
Mdwm.o | 0
Mpatches/dwm-statuscmd-signal-6.2.diff | 8++++----
Dpatches/dwm-vanitygaps-20190508-6.2.diff | 259-------------------------------------------------------------------------------
Dpatches/dwm-vanitygaps-20200610-f09418b.diff | 262-------------------------------------------------------------------------------
Apatches/dwm-xresources-6.2.diff | 235+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mvanitygaps.c | 27++++++++-------------------
10 files changed, 435 insertions(+), 716 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -14,8 +14,7 @@ static int smartgaps = 0; /* 1 means no outer gap when the static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ static int showbar = 1; /* 0 means no bar */ static int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "Hack:pixelsize=15:antialias=true:autohint=true:spacing=false", - "Symbola:pixelsize=15" }; +static const char *fonts[] = { "Hack:pixelsize=16:antialias=true:autohint=true:spacing=false", "Symbola:pixelsize=16" }; static char normfgcolor[] = "#6c6c93"; static char normbgcolor[] = "#263238"; static char normbordercolor[] = "#263238"; @@ -51,6 +50,25 @@ static int resizehints = 1; /* 1 means respect size hints in tiled resizals * #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 */ + { "[M]", monocle }, + { "[@]", spiral }, + { "[\\]", dwindle }, + { "H[]", deck }, + { "TTT", bstack }, + { "===", bstackhoriz }, + { "HHH", grid }, + { "###", nrowgrid }, + { "---", horizgrid }, + { ":::", gaplessgrid }, + { "|M|", centeredmaster }, + { ">M>", centeredfloatingmaster }, + { "><>", NULL }, /* no layout function means floating behavior */ + { NULL, NULL }, +}; + /* * Xresources preferences to load at startup */ @@ -71,25 +89,6 @@ ResourcePref resources[] = { }; -static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "[M]", monocle }, - { "[@]", spiral }, - { "[\\]", dwindle }, - { "H[]", deck }, - { "TTT", bstack }, - { "===", bstackhoriz }, - { "HHH", grid }, - { "###", nrowgrid }, - { "---", horizgrid }, - { ":::", gaplessgrid }, - { "|M|", centeredmaster }, - { ">M>", centeredfloatingmaster }, - { "><>", NULL }, /* no layout function means floating behavior */ - { NULL, NULL }, -}; - /* key definitions */ #define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ @@ -101,25 +100,34 @@ static const Layout layouts[] = { { MOD, XK_j, ACTION##stack, {.i = INC(+1) } }, \ { MOD, XK_k, ACTION##stack, {.i = INC(-1) } }, \ { MOD, XK_grave, ACTION##stack, {.i = PREVSEL } }, \ - /*{ MOD, XK_q, ACTION##stack, {.i = 0 } }, \*/ - /*{ MOD, XK_a, ACTION##stack, {.i = 1 } }, \*/ - /*{ MOD, XK_z, ACTION##stack, {.i = 2 } }, \*/ - /*{ MOD, XK_x, ACTION##stack, {.i = -1 } }, */ + { MOD, XK_q, ACTION##stack, {.i = 0 } }, \ + { MOD, XK_a, ACTION##stack, {.i = 1 } }, \ + { MOD, XK_z, ACTION##stack, {.i = 2 } }, \ + { MOD, XK_x, ACTION##stack, {.i = -1 } }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; static const char *termcmd[] = { "st", NULL }; static const char scratchpadname[] = "scratchpad"; static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; /* commands spawned when clicking statusbar, the mouse button pressed is exported as BUTTON */ +static char *statuscmds[] = { "notify-send Mouse$BUTTON" }; +static char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL }; + static Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_d, spawn, SHCMD("dmenu_run") }, - { MODKEY, XK_p, spawn, SHCMD("passmenu-otp") }, + STACKKEYS(MODKEY, focus) + STACKKEYS(MODKEY|ShiftMask, push) + { MODKEY, XK_Return, spawn, {.v = termcmd }}, + { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, + { MODKEY, XK_d, spawn, {.v = dmenucmd }}, + { MODKEY, XK_p, spawn, SHCMD("passmenu-otp")}, { MODKEY, XK_b, spawn, SHCMD("nautilus") }, { MODKEY, XK_n, spawn, SHCMD(TERMINAL " -e newsboat") }, { MODKEY, XK_c, spawn, SHCMD("brave") }, @@ -132,55 +140,52 @@ static Key keys[] = { { MODKEY, XK_F4, spawn, SHCMD("pkill -RTMIN+8 dwmblocks ; toggle sink") }, { MODKEY, XK_F5, spawn, SHCMD("sudo xbacklight -dec 10") }, { MODKEY, XK_F6, spawn, SHCMD("sudo xbacklight -inc 10") }, - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, - { MODKEY|ShiftMask, XK_b, togglebar, {0} }, - STACKKEYS(MODKEY, focus ) - STACKKEYS(MODKEY|ShiftMask, push ) - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_o, incnmaster, {.i = -1 } }, - { MODKEY, XK_comma, setmfact, {.f = -0.05} }, -{ MODKEY, XK_period, setmfact, {.f = +0.05} }, - { MODKEY|Mod1Mask, XK_k, incrgaps, {.i = +5 } }, - { MODKEY|Mod1Mask, XK_j, incrgaps, {.i = -5 } }, - { MODKEY|Mod1Mask, XK_0, togglegaps, {0} }, - { MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} }, -/* { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },*/ -/* { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },*/ -/* { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },*/ -/* { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },*/ -/* { MODKEY, XK_y, incrihgaps, {.i = +1 } },*/ -/* { MODKEY, XK_o, incrihgaps, {.i = -1 } },*/ -/* { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },*/ -/* { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } },*/ -/* { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } },*/ -/* { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } },*/ -/* { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } },*/ -/* { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } },*/ - { MODKEY|ShiftMask, XK_f, zoom, {0} }, - { MODKEY|ShiftMask, XK_q, killclient, {0} }, - { MODKEY, XK_F9, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_F10, setlayout, {.v = &layouts[7]} }, - { MODKEY, XK_F11, setlayout, {.v = &layouts[9]} }, - { MODKEY, XK_F12, setlayout, {.v = &layouts[11]} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY, XK_f, togglefullscr, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_h, focusmon, {.i = -1 } }, - { MODKEY, XK_l, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } }, - TAGKEYS( XK_1, 0 ) - TAGKEYS( XK_2, 1 ) - TAGKEYS( XK_3, 2 ) - TAGKEYS( XK_4, 3 ) - TAGKEYS( XK_5, 4 ) - TAGKEYS( XK_6, 5 ) - TAGKEYS( XK_7, 6 ) - TAGKEYS( XK_8, 7 ) - TAGKEYS( XK_9, 8 ) + { MODKEY|ShiftMask, XK_b, togglebar, {0}}, + { MODKEY|Mod1Mask, XK_i, incnmaster, {.i = +1 }}, + { MODKEY|Mod1Mask, XK_d, incnmaster, {.i = -1 }}, + { MODKEY, XK_comma, setmfact, {.f = -0.05}}, + { MODKEY, XK_period, setmfact, {.f = +0.05}}, + { MODKEY|ShiftMask, XK_f, zoom, {0} }, + { MODKEY|Mod1Mask, XK_k, incrgaps, {.i = +1 }}, + { MODKEY|Mod1Mask, XK_j, incrgaps, {.i = -1 }}, + { MODKEY|Mod1Mask, XK_i, incrigaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_o, incrogaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_6, incrihgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_7, incrivgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_8, incrohgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_9, incrovgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_0, togglegaps, {0} }, + { MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} }, + { MODKEY|ShiftMask, XK_q, killclient, {0} }, + { MODKEY, XK_F9, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_F10, setlayout, {.v = &layouts[7]} }, + { MODKEY, XK_F11, setlayout, {.v = &layouts[9]} }, + { MODKEY, XK_F12, setlayout, {.v = &layouts[11]} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_l, focusmon, {.i = -1 } }, + { MODKEY, XK_h, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_r, quit, {0} }, { MODKEY|ShiftMask, XK_e, spawn, SHCMD("killall xinit") }, }; @@ -188,8 +193,9 @@ static Key keys[] = { /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = { - /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[13]} }, { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button1, sigdwmblocks, {.i = 1} }, { ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2} }, @@ -198,8 +204,6 @@ static Button buttons[] = { { ClkStatusText, 0, Button5, sigdwmblocks, {.i = 5} }, { ClkStatusText, ShiftMask, Button1, sigdwmblocks, {.i = 6} }, { ClkStatusText, ShiftMask, Button3, spawn, SHCMD(TERMINAL " -e nvim ~/.local/src/dwmblocks/config.h") }, - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[13]} }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, diff --git a/config.h b/config.h @@ -14,8 +14,7 @@ static int smartgaps = 0; /* 1 means no outer gap when the static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ static int showbar = 1; /* 0 means no bar */ static int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "Hack:pixelsize=15:antialias=true:autohint=true:spacing=false", - "Symbola:pixelsize=15" }; +static const char *fonts[] = { "Hack:pixelsize=16:antialias=true:autohint=true:spacing=false", "Symbola:pixelsize=16" }; static char normfgcolor[] = "#6c6c93"; static char normbgcolor[] = "#263238"; static char normbordercolor[] = "#263238"; @@ -51,6 +50,25 @@ static int resizehints = 1; /* 1 means respect size hints in tiled resizals * #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 */ + { "[M]", monocle }, + { "[@]", spiral }, + { "[\\]", dwindle }, + { "H[]", deck }, + { "TTT", bstack }, + { "===", bstackhoriz }, + { "HHH", grid }, + { "###", nrowgrid }, + { "---", horizgrid }, + { ":::", gaplessgrid }, + { "|M|", centeredmaster }, + { ">M>", centeredfloatingmaster }, + { "><>", NULL }, /* no layout function means floating behavior */ + { NULL, NULL }, +}; + /* * Xresources preferences to load at startup */ @@ -71,25 +89,6 @@ ResourcePref resources[] = { }; -static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "[M]", monocle }, - { "[@]", spiral }, - { "[\\]", dwindle }, - { "H[]", deck }, - { "TTT", bstack }, - { "===", bstackhoriz }, - { "HHH", grid }, - { "###", nrowgrid }, - { "---", horizgrid }, - { ":::", gaplessgrid }, - { "|M|", centeredmaster }, - { ">M>", centeredfloatingmaster }, - { "><>", NULL }, /* no layout function means floating behavior */ - { NULL, NULL }, -}; - /* key definitions */ #define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ @@ -101,25 +100,34 @@ static const Layout layouts[] = { { MOD, XK_j, ACTION##stack, {.i = INC(+1) } }, \ { MOD, XK_k, ACTION##stack, {.i = INC(-1) } }, \ { MOD, XK_grave, ACTION##stack, {.i = PREVSEL } }, \ - /*{ MOD, XK_q, ACTION##stack, {.i = 0 } }, \*/ - /*{ MOD, XK_a, ACTION##stack, {.i = 1 } }, \*/ - /*{ MOD, XK_z, ACTION##stack, {.i = 2 } }, \*/ - /*{ MOD, XK_x, ACTION##stack, {.i = -1 } }, */ + { MOD, XK_q, ACTION##stack, {.i = 0 } }, \ + { MOD, XK_a, ACTION##stack, {.i = 1 } }, \ + { MOD, XK_z, ACTION##stack, {.i = 2 } }, \ + { MOD, XK_x, ACTION##stack, {.i = -1 } }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; static const char *termcmd[] = { "st", NULL }; static const char scratchpadname[] = "scratchpad"; static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; /* commands spawned when clicking statusbar, the mouse button pressed is exported as BUTTON */ +static char *statuscmds[] = { "notify-send Mouse$BUTTON" }; +static char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL }; + static Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_d, spawn, SHCMD("dmenu_run") }, - { MODKEY, XK_p, spawn, SHCMD("passmenu-otp") }, + STACKKEYS(MODKEY, focus) + STACKKEYS(MODKEY|ShiftMask, push) + { MODKEY, XK_Return, spawn, {.v = termcmd }}, + { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, + { MODKEY, XK_d, spawn, {.v = dmenucmd }}, + { MODKEY, XK_p, spawn, SHCMD("passmenu-otp")}, { MODKEY, XK_b, spawn, SHCMD("nautilus") }, { MODKEY, XK_n, spawn, SHCMD(TERMINAL " -e newsboat") }, { MODKEY, XK_c, spawn, SHCMD("brave") }, @@ -132,55 +140,52 @@ static Key keys[] = { { MODKEY, XK_F4, spawn, SHCMD("pkill -RTMIN+8 dwmblocks ; toggle sink") }, { MODKEY, XK_F5, spawn, SHCMD("sudo xbacklight -dec 10") }, { MODKEY, XK_F6, spawn, SHCMD("sudo xbacklight -inc 10") }, - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, - { MODKEY|ShiftMask, XK_b, togglebar, {0} }, - STACKKEYS(MODKEY, focus ) - STACKKEYS(MODKEY|ShiftMask, push ) - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_o, incnmaster, {.i = -1 } }, - { MODKEY, XK_comma, setmfact, {.f = -0.05} }, -{ MODKEY, XK_period, setmfact, {.f = +0.05} }, - { MODKEY|Mod1Mask, XK_k, incrgaps, {.i = +5 } }, - { MODKEY|Mod1Mask, XK_j, incrgaps, {.i = -5 } }, - { MODKEY|Mod1Mask, XK_0, togglegaps, {0} }, - { MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} }, -/* { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },*/ -/* { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },*/ -/* { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },*/ -/* { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },*/ -/* { MODKEY, XK_y, incrihgaps, {.i = +1 } },*/ -/* { MODKEY, XK_o, incrihgaps, {.i = -1 } },*/ -/* { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },*/ -/* { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } },*/ -/* { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } },*/ -/* { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } },*/ -/* { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } },*/ -/* { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } },*/ - { MODKEY|ShiftMask, XK_f, zoom, {0} }, - { MODKEY|ShiftMask, XK_q, killclient, {0} }, - { MODKEY, XK_F9, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_F10, setlayout, {.v = &layouts[7]} }, - { MODKEY, XK_F11, setlayout, {.v = &layouts[9]} }, - { MODKEY, XK_F12, setlayout, {.v = &layouts[11]} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY, XK_f, togglefullscr, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_h, focusmon, {.i = -1 } }, - { MODKEY, XK_l, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } }, - TAGKEYS( XK_1, 0 ) - TAGKEYS( XK_2, 1 ) - TAGKEYS( XK_3, 2 ) - TAGKEYS( XK_4, 3 ) - TAGKEYS( XK_5, 4 ) - TAGKEYS( XK_6, 5 ) - TAGKEYS( XK_7, 6 ) - TAGKEYS( XK_8, 7 ) - TAGKEYS( XK_9, 8 ) + { MODKEY|ShiftMask, XK_b, togglebar, {0}}, + { MODKEY|Mod1Mask, XK_i, incnmaster, {.i = +1 }}, + { MODKEY|Mod1Mask, XK_d, incnmaster, {.i = -1 }}, + { MODKEY, XK_comma, setmfact, {.f = -0.05}}, + { MODKEY, XK_period, setmfact, {.f = +0.05}}, + { MODKEY|ShiftMask, XK_f, zoom, {0} }, + { MODKEY|Mod1Mask, XK_k, incrgaps, {.i = +1 }}, + { MODKEY|Mod1Mask, XK_j, incrgaps, {.i = -1 }}, + { MODKEY|Mod1Mask, XK_i, incrigaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_o, incrogaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_6, incrihgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_7, incrivgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_8, incrohgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_9, incrovgaps, {.i = +1 } }, + { MODKEY|Mod1Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_0, togglegaps, {0} }, + { MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} }, + { MODKEY|ShiftMask, XK_q, killclient, {0} }, + { MODKEY, XK_F9, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_F10, setlayout, {.v = &layouts[7]} }, + { MODKEY, XK_F11, setlayout, {.v = &layouts[9]} }, + { MODKEY, XK_F12, setlayout, {.v = &layouts[11]} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_l, focusmon, {.i = -1 } }, + { MODKEY, XK_h, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_r, quit, {0} }, { MODKEY|ShiftMask, XK_e, spawn, SHCMD("killall xinit") }, }; @@ -188,8 +193,9 @@ static Key keys[] = { /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = { - /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[13]} }, { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button1, sigdwmblocks, {.i = 1} }, { ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2} }, @@ -198,8 +204,6 @@ static Button buttons[] = { { ClkStatusText, 0, Button5, sigdwmblocks, {.i = 5} }, { ClkStatusText, ShiftMask, Button1, sigdwmblocks, {.i = 6} }, { ClkStatusText, ShiftMask, Button3, spawn, SHCMD(TERMINAL " -e nvim ~/.local/src/dwmblocks/config.h") }, - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[13]} }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, diff --git a/dwm b/dwm Binary files differ. diff --git a/dwm.c b/dwm.c @@ -60,8 +60,8 @@ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) #define ISINC(X) ((X) > 1000 && (X) < 3000) #define ISVISIBLEONTAG(C, T) ((C->tags & T)) -#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags]) #define PREVSEL 3000 +#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags]) #define LENGTH(X) (sizeof X / sizeof X[0]) #define MOD(N,M) ((N)%(M) < 0 ? (N)%(M) + (M) : (N)%(M)) #define MOUSEMASK (BUTTONMASK|PointerMotionMask) @@ -193,6 +193,7 @@ static void configure(Client *c); static void configurenotify(XEvent *e); static void configurerequest(XEvent *e); static void copyvalidchars(char *text, char *rawtext); +static int getdwmblockspid(); static Monitor *createmon(void); static void destroynotify(XEvent *e); static void detach(Client *c); @@ -206,7 +207,6 @@ static void focus(Client *c); static void focusin(XEvent *e); static void focusmon(const Arg *arg); static void focusstack(const Arg *arg); -static int getdwmblockspid(); static int getrootptr(int *x, int *y); static long getstate(Window w); static int gettextprop(Window w, Atom atom, char *text, unsigned int size); @@ -245,7 +245,6 @@ static void setup(void); static void seturgent(Client *c, int urg); static void showhide(Client *c); static void sigchld(int unused); -static int getdwmblockspid(); static void sigdwmblocks(const Arg *arg); static void spawn(const Arg *arg); static int stackpos(const Arg *arg); @@ -253,8 +252,8 @@ static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); -static void togglefullscr(const Arg *arg); static void togglescratch(const Arg *arg); +static void togglefullscr(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); @@ -290,9 +289,10 @@ static pid_t winpid(Window w); static const char broken[] = "broken"; static char stext[256]; static char rawstext[256]; -static char lastbutton[] = "-"; static int dwmblockssig; pid_t dwmblockspid = 0; +static int statuscmdn; +static char lastbutton[] = "-"; static int screen; static int sw, sh; /* X display screen geometry width, height */ static int bh, blw = 0; /* bar geometry */ @@ -536,7 +536,7 @@ unswallow(Client *c) void buttonpress(XEvent *e) { - unsigned int i, x, click, occ = 0; + unsigned int i, x, click; Arg arg = {0}; Client *c; Monitor *m; @@ -552,13 +552,9 @@ buttonpress(XEvent *e) } if (ev->window == selmon->barwin) { i = x = 0; - for (c = m->clients; c; c = c->next) - occ |= c->tags == 255 ? 0 : c->tags; - do { - if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) - continue; + do x += TEXTW(tags[i]); - } while (ev->x >= x && ++i < LENGTH(tags)); + while (ev->x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; @@ -580,7 +576,7 @@ buttonpress(XEvent *e) text += i+1; i = -1; if (x >= ev->x) break; - dwmblockssig = ch; + dwmblockssig = ch; } } } else @@ -1022,6 +1018,7 @@ getatomprop(Client *c, Atom prop) return atom; } + int getdwmblockspid() { @@ -1034,6 +1031,7 @@ getdwmblockspid() return pid != 0 ? 0 : -1; } + int getrootptr(int *x, int *y) { @@ -1728,7 +1726,7 @@ setmfact(const Arg *arg) if (!arg || !selmon->lt[selmon->sellt]->arrange) return; f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; - if (f < 0.05 || f > 0.95) + if (f < 0.1 || f > 0.9) return; selmon->mfact = f; arrange(selmon); @@ -1861,9 +1859,18 @@ sigdwmblocks(const Arg *arg) } } + + void spawn(const Arg *arg) { + if (arg->v == dmenucmd) + dmenumon[0] = '0' + selmon->num; + else if (arg->v == statuscmd) { + statuscmd[2] = statuscmds[statuscmdn]; + setenv("BUTTON", lastbutton, 1); + } + selmon->tagset[selmon->seltags] &= ~scratchtag; if (fork() == 0) { if (dpy) close(ConnectionNumber(dpy)); @@ -2261,6 +2268,7 @@ void updatestatus(void) { Monitor* m; + if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext))) strcpy(stext, "dwm-"VERSION); else diff --git a/dwm.o b/dwm.o Binary files differ. diff --git a/patches/dwm-statuscmd-signal-6.2.diff b/patches/dwm-statuscmd-signal-6.2.diff @@ -83,7 +83,7 @@ index 4465af1..c600131 100644 @@ -627,6 +650,19 @@ configurerequest(XEvent *e) XSync(dpy, False); } - + +void +copyvalidchars(char *text, char *rawtext) +{ @@ -103,7 +103,7 @@ index 4465af1..c600131 100644 @@ -871,6 +907,18 @@ getatomprop(Client *c, Atom prop) return atom; } - + +int +getdwmblockspid() +{ @@ -122,7 +122,7 @@ index 4465af1..c600131 100644 @@ -1636,6 +1684,23 @@ sigchld(int unused) while (0 < waitpid(-1, NULL, WNOHANG)); } - + +void +sigdwmblocks(const Arg *arg) +{ @@ -154,4 +154,4 @@ index 4465af1..c600131 100644 + copyvalidchars(stext, rawstext); drawbar(selmon); } - + diff --git a/patches/dwm-vanitygaps-20190508-6.2.diff b/patches/dwm-vanitygaps-20190508-6.2.diff @@ -1,259 +0,0 @@ -From 20967685d6879bd611a856ade154df19da9ddc7b Mon Sep 17 00:00:00 2001 -From: Stein Gunnar Bakkeby <bakkeby@gmail.com> -Date: Wed, 8 May 2019 08:07:14 +0200 -Subject: [PATCH] Vanity gaps - allows control of both inner and outer gaps - between windows and screen edge - ---- - config.def.h | 21 +++++++++ - dwm.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 161 insertions(+), 10 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..0927c2d 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -3,6 +3,11 @@ - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ -+static const unsigned int gappih = 10; /* horiz inner gap between windows */ -+static const unsigned int gappiv = 10; /* vert inner gap between windows */ -+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ -+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */ -+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ - static const char *fonts[] = { "monospace:size=10" }; -@@ -70,6 +75,22 @@ static Key keys[] = { - { MODKEY, XK_d, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, -+ { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask, XK_0, togglegaps, {0} }, -+ { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, -+ { MODKEY, XK_y, incrihgaps, {.i = +1 } }, -+ { MODKEY, XK_o, incrihgaps, {.i = -1 } }, -+ { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } }, -+ { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } }, -+ { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, -diff --git a/dwm.c b/dwm.c -index 4465af1..88f3e04 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -119,6 +119,10 @@ struct Monitor { - int by; /* bar geometry */ - int mx, my, mw, mh; /* screen size */ - int wx, wy, ww, wh; /* window area */ -+ int gappih; /* horizontal gap between windows */ -+ int gappiv; /* vertical gap between windows */ -+ int gappoh; /* horizontal outer gaps */ -+ int gappov; /* vertical outer gaps */ - unsigned int seltags; - unsigned int sellt; - unsigned int tagset[2]; -@@ -199,6 +203,16 @@ 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 setgaps(int oh, int ov, int ih, int iv); -+static void incrgaps(const Arg *arg); -+static void incrigaps(const Arg *arg); -+static void incrogaps(const Arg *arg); -+static void incrohgaps(const Arg *arg); -+static void incrovgaps(const Arg *arg); -+static void incrihgaps(const Arg *arg); -+static void incrivgaps(const Arg *arg); -+static void togglegaps(const Arg *arg); -+static void defaultgaps(const Arg *arg); - static void setlayout(const Arg *arg); - static void setmfact(const Arg *arg); - static void setup(void); -@@ -240,6 +254,7 @@ static char stext[256]; - static int screen; - static int sw, sh; /* X display screen geometry width, height */ - static int bh, blw = 0; /* bar geometry */ -+static int enablegaps = 1; /* enables gaps, used by togglegaps */ - static int lrpad; /* sum of left and right padding for text */ - static int (*xerrorxlib)(Display *, XErrorEvent *); - static unsigned int numlockmask = 0; -@@ -638,6 +653,10 @@ createmon(void) - m->nmaster = nmaster; - m->showbar = showbar; - m->topbar = topbar; -+ m->gappih = gappih; -+ m->gappiv = gappiv; -+ m->gappoh = gappoh; -+ m->gappov = gappov; - m->lt[0] = &layouts[0]; - m->lt[1] = &layouts[1 % LENGTH(layouts)]; - strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); -@@ -1498,6 +1517,111 @@ setfullscreen(Client *c, int fullscreen) - } - - void -+setgaps(int oh, int ov, int ih, int iv) -+{ -+ if (oh < 0) oh = 0; -+ if (ov < 0) ov = 0; -+ if (ih < 0) ih = 0; -+ if (iv < 0) iv = 0; -+ -+ selmon->gappoh = oh; -+ selmon->gappov = ov; -+ selmon->gappih = ih; -+ selmon->gappiv = iv; -+ arrange(selmon); -+} -+ -+void -+togglegaps(const Arg *arg) -+{ -+ enablegaps = !enablegaps; -+ arrange(selmon); -+} -+ -+void -+defaultgaps(const Arg *arg) -+{ -+ setgaps(gappoh, gappov, gappih, gappiv); -+} -+ -+void -+incrgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov + arg->i, -+ selmon->gappih + arg->i, -+ selmon->gappiv + arg->i -+ ); -+} -+ -+void -+incrigaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov, -+ selmon->gappih + arg->i, -+ selmon->gappiv + arg->i -+ ); -+} -+ -+void -+incrogaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov + arg->i, -+ selmon->gappih, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrohgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov, -+ selmon->gappih, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrovgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov + arg->i, -+ selmon->gappih, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrihgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov, -+ selmon->gappih + arg->i, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrivgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov, -+ selmon->gappih, -+ selmon->gappiv + arg->i -+ ); -+} -+ -+void - setlayout(const Arg *arg) - { - if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) -@@ -1673,26 +1797,32 @@ tagmon(const Arg *arg) - void - tile(Monitor *m) - { -- unsigned int i, n, h, mw, my, ty; -+ unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (n == 0) - return; - -+ if (smartgaps == n) { -+ oe = 0; // outer gaps disabled -+ } -+ - if (n > m->nmaster) -- mw = m->nmaster ? m->ww * m->mfact : 0; -+ mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0; - else -- mw = m->ww; -- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) -+ mw = m->ww - 2*m->gappov*oe + m->gappiv*ie; -+ for (i = 0, my = ty = m->gappoh*oe, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { -- h = (m->wh - my) / (MIN(n, m->nmaster) - i); -- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); -- my += HEIGHT(c); -+ r = MIN(n, m->nmaster) - i; -+ h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; -+ resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0); -+ my += HEIGHT(c) + m->gappih*ie; - } else { -- h = (m->wh - ty) / (n - i); -- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); -- ty += HEIGHT(c); -+ r = n - i; -+ h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; -+ resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0); -+ ty += HEIGHT(c) + m->gappih*ie; - } - } - --- -2.7.4 - diff --git a/patches/dwm-vanitygaps-20200610-f09418b.diff b/patches/dwm-vanitygaps-20200610-f09418b.diff @@ -1,262 +0,0 @@ -From c35fd03ec002e1f4476a75203ff9b5cbcc630177 Mon Sep 17 00:00:00 2001 -From: Michel Boaventura <michel.boaventura@protonmail.com> -Date: Wed, 10 Jun 2020 10:46:51 -0300 -Subject: [PATCH] Update Vanity Gaps to master - ---- - config.def.h | 21 +++++++ - dwm.c | 154 +++++++++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 163 insertions(+), 12 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1c0b587..0927c2d 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -3,6 +3,11 @@ - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ -+static const unsigned int gappih = 10; /* horiz inner gap between windows */ -+static const unsigned int gappiv = 10; /* vert inner gap between windows */ -+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ -+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */ -+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ - static const char *fonts[] = { "monospace:size=10" }; -@@ -70,6 +75,22 @@ static Key keys[] = { - { MODKEY, XK_d, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, -+ { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask, XK_0, togglegaps, {0} }, -+ { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, -+ { MODKEY, XK_y, incrihgaps, {.i = +1 } }, -+ { MODKEY, XK_o, incrihgaps, {.i = -1 } }, -+ { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } }, -+ { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } }, -+ { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } }, -+ { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } }, -+ { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, -diff --git a/dwm.c b/dwm.c -index 9fd0286..50dbbaf 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -119,6 +119,10 @@ struct Monitor { - int by; /* bar geometry */ - int mx, my, mw, mh; /* screen size */ - int wx, wy, ww, wh; /* window area */ -+ int gappih; /* horizontal gap between windows */ -+ int gappiv; /* vertical gap between windows */ -+ int gappoh; /* horizontal outer gaps */ -+ int gappov; /* vertical outer gaps */ - unsigned int seltags; - unsigned int sellt; - unsigned int tagset[2]; -@@ -200,6 +204,16 @@ 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 setgaps(int oh, int ov, int ih, int iv); -+static void incrgaps(const Arg *arg); -+static void incrigaps(const Arg *arg); -+static void incrogaps(const Arg *arg); -+static void incrohgaps(const Arg *arg); -+static void incrovgaps(const Arg *arg); -+static void incrihgaps(const Arg *arg); -+static void incrivgaps(const Arg *arg); -+static void togglegaps(const Arg *arg); -+static void defaultgaps(const Arg *arg); - static void setlayout(const Arg *arg); - static void setmfact(const Arg *arg); - static void setup(void); -@@ -241,6 +255,7 @@ static char stext[256]; - static int screen; - static int sw, sh; /* X display screen geometry width, height */ - static int bh, blw = 0; /* bar geometry */ -+static int enablegaps = 1; /* enables gaps, used by togglegaps */ - static int lrpad; /* sum of left and right padding for text */ - static int (*xerrorxlib)(Display *, XErrorEvent *); - static unsigned int numlockmask = 0; -@@ -639,6 +654,10 @@ createmon(void) - m->nmaster = nmaster; - m->showbar = showbar; - m->topbar = topbar; -+ m->gappih = gappih; -+ m->gappiv = gappiv; -+ m->gappoh = gappoh; -+ m->gappov = gappov; - m->lt[0] = &layouts[0]; - m->lt[1] = &layouts[1 % LENGTH(layouts)]; - strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); -@@ -1498,6 +1517,111 @@ setfullscreen(Client *c, int fullscreen) - } - } - -+void -+setgaps(int oh, int ov, int ih, int iv) -+{ -+ if (oh < 0) oh = 0; -+ if (ov < 0) ov = 0; -+ if (ih < 0) ih = 0; -+ if (iv < 0) iv = 0; -+ -+ selmon->gappoh = oh; -+ selmon->gappov = ov; -+ selmon->gappih = ih; -+ selmon->gappiv = iv; -+ arrange(selmon); -+} -+ -+void -+togglegaps(const Arg *arg) -+{ -+ enablegaps = !enablegaps; -+ arrange(selmon); -+} -+ -+void -+defaultgaps(const Arg *arg) -+{ -+ setgaps(gappoh, gappov, gappih, gappiv); -+} -+ -+void -+incrgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov + arg->i, -+ selmon->gappih + arg->i, -+ selmon->gappiv + arg->i -+ ); -+} -+ -+void -+incrigaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov, -+ selmon->gappih + arg->i, -+ selmon->gappiv + arg->i -+ ); -+} -+ -+void -+incrogaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov + arg->i, -+ selmon->gappih, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrohgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh + arg->i, -+ selmon->gappov, -+ selmon->gappih, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrovgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov + arg->i, -+ selmon->gappih, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrihgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov, -+ selmon->gappih + arg->i, -+ selmon->gappiv -+ ); -+} -+ -+void -+incrivgaps(const Arg *arg) -+{ -+ setgaps( -+ selmon->gappoh, -+ selmon->gappov, -+ selmon->gappih, -+ selmon->gappiv + arg->i -+ ); -+} -+ - void - setlayout(const Arg *arg) - { -@@ -1674,28 +1798,34 @@ tagmon(const Arg *arg) - void - tile(Monitor *m) - { -- unsigned int i, n, h, mw, my, ty; -+ unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (n == 0) - return; - -+ if (smartgaps == n) { -+ oe = 0; // outer gaps disabled -+ } -+ - if (n > m->nmaster) -- mw = m->nmaster ? m->ww * m->mfact : 0; -+ mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0; - else -- mw = m->ww; -- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) -+ mw = m->ww - 2*m->gappov*oe + m->gappiv*ie; -+ for (i = 0, my = ty = m->gappoh*oe, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) - if (i < m->nmaster) { -- h = (m->wh - my) / (MIN(n, m->nmaster) - i); -- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); -- if (my + HEIGHT(c) < m->wh) -- my += HEIGHT(c); -+ r = MIN(n, m->nmaster) - i; -+ h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; -+ resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0); -+ if (my + HEIGHT(c) + m->gappih*ie < m->wh) -+ my += HEIGHT(c) + m->gappih*ie; - } else { -- h = (m->wh - ty) / (n - i); -- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); -- if (ty + HEIGHT(c) < m->wh) -- ty += HEIGHT(c); -+ r = n - i; -+ h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; -+ resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0); -+ if (ty + HEIGHT(c) + m->gappih*ie < m->wh) -+ ty += HEIGHT(c) + m->gappih*ie; - } - } - --- -2.27.0 - diff --git a/patches/dwm-xresources-6.2.diff b/patches/dwm-xresources-6.2.diff @@ -0,0 +1,235 @@ +From 2832bd78a690606a48a7e1d370cd60fd92ee4988 Mon Sep 17 00:00:00 2001 +From: MLquest8 <miskuzius@gmail.com> +Date: Fri, 12 Jun 2020 15:43:31 +0400 +Subject: [PATCH] handle various setting of various types from Xresources + +--- + config.def.h | 54 ++++++++++++++++++++++++++------------- + drw.c | 2 +- + drw.h | 2 +- + dwm.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 111 insertions(+), 19 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..e69f288 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -1,21 +1,22 @@ + /* See LICENSE file for copyright and license details. */ + + /* appearance */ +-static const unsigned int borderpx = 1; /* border pixel of 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 */ ++static unsigned int borderpx = 1; /* border pixel of windows */ ++static unsigned int snap = 32; /* snap pixel */ ++static int showbar = 1; /* 0 means no bar */ ++static int topbar = 1; /* 0 means bottom bar */ + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; +-static const char col_gray1[] = "#222222"; +-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 char normbgcolor[] = "#222222"; ++static char normbordercolor[] = "#444444"; ++static char normfgcolor[] = "#bbbbbb"; ++static char selfgcolor[] = "#eeeeee"; ++static char selbordercolor[] = "#005577"; ++static char selbgcolor[] = "#005577"; ++static char *colors[][3] = { ++ /* fg bg border */ ++ [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor }, ++ [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor }, + }; + + /* tagging */ +@@ -32,9 +33,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 float mfact = 0.55; /* factor of master area size [0.05..0.95] */ ++static int nmaster = 1; /* number of clients in master area */ ++static int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + + static const Layout layouts[] = { + /* symbol arrange function */ +@@ -56,9 +57,28 @@ 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", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; ++static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL }; + static const char *termcmd[] = { "st", NULL }; + ++/* ++ * Xresources preferences to load at startup ++ */ ++ResourcePref resources[] = { ++ { "normbgcolor", STRING, &normbgcolor }, ++ { "normbordercolor", STRING, &normbordercolor }, ++ { "normfgcolor", STRING, &normfgcolor }, ++ { "selbgcolor", STRING, &selbgcolor }, ++ { "selbordercolor", STRING, &selbordercolor }, ++ { "selfgcolor", STRING, &selfgcolor }, ++ { "borderpx", INTEGER, &borderpx }, ++ { "snap", INTEGER, &snap }, ++ { "showbar", INTEGER, &showbar }, ++ { "topbar", INTEGER, &topbar }, ++ { "nmaster", INTEGER, &nmaster }, ++ { "resizehints", INTEGER, &resizehints }, ++ { "mfact", FLOAT, &mfact }, ++}; ++ + static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, +diff --git a/drw.c b/drw.c +index 4cdbcbe..8f1059e 100644 +--- a/drw.c ++++ b/drw.c +@@ -208,7 +208,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname) + /* Wrapper to create color schemes. The caller has to call free(3) on the + * returned color scheme when done using it. */ + Clr * +-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) ++drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount) + { + size_t i; + Clr *ret; +diff --git a/drw.h b/drw.h +index 4bcd5ad..42b04ce 100644 +--- a/drw.h ++++ b/drw.h +@@ -39,7 +39,7 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in + + /* Colorscheme abstraction */ + void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); +-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); ++Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); + + /* Cursor abstraction */ + Cur *drw_cur_create(Drw *drw, int shape); +diff --git a/dwm.c b/dwm.c +index 9fd0286..dc0d219 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -36,6 +36,7 @@ + #include <X11/Xlib.h> + #include <X11/Xproto.h> + #include <X11/Xutil.h> ++#include <X11/Xresource.h> + #ifdef XINERAMA + #include <X11/extensions/Xinerama.h> + #endif /* XINERAMA */ +@@ -141,6 +142,19 @@ typedef struct { + int monitor; + } Rule; + ++/* Xresources preferences */ ++enum resource_type { ++ STRING = 0, ++ INTEGER = 1, ++ FLOAT = 2 ++}; ++ ++typedef struct { ++ char *name; ++ enum resource_type type; ++ void *dst; ++} ResourcePref; ++ + /* function declarations */ + static void applyrules(Client *c); + static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); +@@ -234,6 +248,8 @@ static int xerror(Display *dpy, XErrorEvent *ee); + static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); ++static void load_xresources(void); ++static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst); + + /* variables */ + static const char broken[] = "broken"; +@@ -2127,6 +2143,60 @@ zoom(const Arg *arg) + pop(c); + } + ++void ++resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) ++{ ++ char *sdst = NULL; ++ int *idst = NULL; ++ float *fdst = NULL; ++ ++ sdst = dst; ++ idst = dst; ++ fdst = dst; ++ ++ char fullname[256]; ++ char *type; ++ XrmValue ret; ++ ++ snprintf(fullname, sizeof(fullname), "%s.%s", "dwm", name); ++ fullname[sizeof(fullname) - 1] = '\0'; ++ ++ XrmGetResource(db, fullname, "*", &type, &ret); ++ if (!(ret.addr == NULL || strncmp("String", type, 64))) ++ { ++ switch (rtype) { ++ case STRING: ++ strcpy(sdst, ret.addr); ++ break; ++ case INTEGER: ++ *idst = strtoul(ret.addr, NULL, 10); ++ break; ++ case FLOAT: ++ *fdst = strtof(ret.addr, NULL); ++ break; ++ } ++ } ++} ++ ++void ++load_xresources(void) ++{ ++ Display *display; ++ char *resm; ++ XrmDatabase db; ++ ResourcePref *p; ++ ++ display = XOpenDisplay(NULL); ++ resm = XResourceManagerString(display); ++ if (!resm) ++ return; ++ ++ db = XrmGetStringDatabase(resm); ++ for (p = resources; p < resources + LENGTH(resources); p++) ++ resource_load(db, p->name, p->type, p->dst); ++ XCloseDisplay(display); ++} ++ + int + main(int argc, char *argv[]) + { +@@ -2139,6 +2209,8 @@ main(int argc, char *argv[]) + if (!(dpy = XOpenDisplay(NULL))) + die("dwm: cannot open display"); + checkotherwm(); ++ XrmInitialize(); ++ load_xresources(); + setup(); + #ifdef __OpenBSD__ + if (pledge("stdio rpath proc exec", NULL) == -1) +-- +2.26.2 + diff --git a/vanitygaps.c b/vanitygaps.c @@ -1,12 +1,12 @@ /* Key binding functions */ static void defaultgaps(const Arg *arg); static void incrgaps(const Arg *arg); -/*static void incrigaps(const Arg *arg);*/ -/*static void incrogaps(const Arg *arg);*/ -/*static void incrohgaps(const Arg *arg);*/ -/*static void incrovgaps(const Arg *arg);*/ -/*static void incrihgaps(const Arg *arg);*/ -/*static void incrivgaps(const Arg *arg);*/ +static void incrigaps(const Arg *arg); +static void incrogaps(const Arg *arg); +static void incrohgaps(const Arg *arg); +static void incrovgaps(const Arg *arg); +static void incrihgaps(const Arg *arg); +static void incrivgaps(const Arg *arg); static void togglegaps(const Arg *arg); /* Layouts (delete the ones you do not need) */ static void bstack(Monitor *m); @@ -73,7 +73,6 @@ incrgaps(const Arg *arg) ); } -/* void incrigaps(const Arg *arg) { @@ -84,9 +83,7 @@ incrigaps(const Arg *arg) selmon->gappiv + arg->i ); } -*/ -/* void incrogaps(const Arg *arg) { @@ -97,9 +94,7 @@ incrogaps(const Arg *arg) selmon->gappiv ); } -*/ -/* void incrohgaps(const Arg *arg) { @@ -110,9 +105,7 @@ incrohgaps(const Arg *arg) selmon->gappiv ); } -*/ -/* void incrovgaps(const Arg *arg) { @@ -123,9 +116,7 @@ incrovgaps(const Arg *arg) selmon->gappiv ); } -*/ -/* void incrihgaps(const Arg *arg) { @@ -136,9 +127,7 @@ incrihgaps(const Arg *arg) selmon->gappiv ); } -*/ -/* void incrivgaps(const Arg *arg) { @@ -149,7 +138,6 @@ incrivgaps(const Arg *arg) selmon->gappiv + arg->i ); } -*/ void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc) @@ -818,4 +806,4 @@ tile(Monitor *m) resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0); sy += HEIGHT(c) + ih; } -} +} +\ No newline at end of file