more
This commit is contained in:
parent
2c5c663571
commit
d5fb9c9217
116
config.def.h.orig
Normal file
116
config.def.h.orig
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/* 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 const char *fonts[] = { "Fairfax Hax HD:size=22" };
|
||||||
|
static const char dmenufont[] = "Fairfax Hax HD:size=22";
|
||||||
|
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 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 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 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 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 lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
|
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
#define MODKEY Mod4Mask
|
||||||
|
#define TAGKEYS(KEY,TAG) \
|
||||||
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
|
|
||||||
|
/* 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, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||||
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
|
static const Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||||
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, 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, self_restart, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* button definitions */
|
||||||
|
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||||
|
static const Button buttons[] = {
|
||||||
|
/* click event mask button function argument */
|
||||||
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||||
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
|
{ ClkTagBar, 0, Button1, view, {0} },
|
||||||
|
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
|
};
|
11
config.def.h.rej
Normal file
11
config.def.h.rej
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- config.def.h Tue Dec 04 21:54:44 2012 +0200
|
||||||
|
+++ config.def.h Tue Dec 04 21:54:44 2012 +0200
|
||||||
|
@@ -54,6 +54,8 @@
|
||||||
|
static const char *termcmd[] = { "urxvtc", NULL };
|
||||||
|
static const char *filemancmd[] = { "thunar", NULL };
|
||||||
|
|
||||||
|
+#include "selfrestart.c"
|
||||||
|
+
|
||||||
|
static Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY, XK_r, spawn, {.v = dmenucmd } },
|
179
config.h
Normal file
179
config.h
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
/* custom functions declarations */
|
||||||
|
static void shutdown(const Arg *arg);
|
||||||
|
|
||||||
|
/* custom includes */
|
||||||
|
#include <X11/XF86keysym.h>
|
||||||
|
#include "selfrestart.c"
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static unsigned int borderpx = 2; /* border pixel of windows */
|
||||||
|
static const int startwithgaps = 0; /* 1 means gaps are used by default */
|
||||||
|
static const unsigned int gappx = 10; /* default gap between windows in pixels */
|
||||||
|
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[] = { "Cascadia Code:size=10" };
|
||||||
|
static const char dmenufont[] = "Cascadia Code:size=10";
|
||||||
|
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 },
|
||||||
|
//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 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* tagging */
|
||||||
|
static const char *tags[] = { "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט" };
|
||||||
|
|
||||||
|
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 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
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 int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Xresources preferences to load at startup
|
||||||
|
*/
|
||||||
|
ResourcePref resources[] = {
|
||||||
|
{ "color0", STRING, &normbgcolor },
|
||||||
|
{ "color0", STRING, &normbordercolor },
|
||||||
|
{ "color4", STRING, &normfgcolor },
|
||||||
|
{ "color4", STRING, &selbgcolor },
|
||||||
|
{ "color8", STRING, &selbordercolor },
|
||||||
|
{ "color0", STRING, &selfgcolor },
|
||||||
|
{ "borderpx", INTEGER, &borderpx },
|
||||||
|
{ "snap", INTEGER, &snap },
|
||||||
|
{ "showbar", INTEGER, &showbar },
|
||||||
|
{ "topbar", INTEGER, &topbar },
|
||||||
|
{ "nmaster", INTEGER, &nmaster },
|
||||||
|
{ "resizehints", INTEGER, &resizehints },
|
||||||
|
{ "mfact", FLOAT, &mfact },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
#define MODKEY Mod4Mask
|
||||||
|
#define TAGKEYS(KEY,TAG) \
|
||||||
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
|
|
||||||
|
/* 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, "-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 };
|
||||||
|
|
||||||
|
static const Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||||
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
|
||||||
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||||
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
{ 0, XF86XK_AudioMute, spawn, SHCMD("pactl set-sink-mute @DEFAULT_SINK@ toggle")},
|
||||||
|
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -2%")},
|
||||||
|
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +2%")},
|
||||||
|
{ 0, XF86XK_AudioPrev, spawn, SHCMD("playerctl previous")},
|
||||||
|
{ 0, XF86XK_AudioPlay, spawn, SHCMD("playerctl play-pause")},
|
||||||
|
{ 0, XF86XK_AudioNext, spawn, SHCMD("playerctl next")},
|
||||||
|
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 1%-")},
|
||||||
|
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set 1%+")},
|
||||||
|
{ MODKEY, XK_e, spawn, SHCMD("dmenu_emoji")},
|
||||||
|
{ Mod1Mask, XK_space, spawn, SHCMD("setxkbmap il")},
|
||||||
|
{ Mod1Mask|ShiftMask, XK_space, spawn, SHCMD("setxkbmap us")},
|
||||||
|
{ MODKEY, XK_Escape, spawn, SHCMD("slock")},
|
||||||
|
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, XK_minus, setgaps, {.i = -5 } },
|
||||||
|
{ MODKEY, XK_equal, setgaps, {.i = +5 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_minus, setgaps, {.i = GAP_RESET } },
|
||||||
|
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = GAP_TOGGLE} },
|
||||||
|
{ MODKEY|ShiftMask, XK_r, self_restart, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_q, shutdown, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* button definitions */
|
||||||
|
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||||
|
static const Button buttons[] = {
|
||||||
|
/* click event mask button function argument */
|
||||||
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||||
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
|
{ ClkTagBar, 0, Button1, view, {0} },
|
||||||
|
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* custom function definitions */
|
||||||
|
|
||||||
|
static void shutdown(const Arg *arg) {
|
||||||
|
Arg cmd = SHCMD("/home/mikec/.scripts/shutdown.sh");
|
||||||
|
spawn(&cmd);
|
||||||
|
quit(arg);
|
||||||
|
}
|
2237
dwm.c.orig
Normal file
2237
dwm.c.orig
Normal file
File diff suppressed because it is too large
Load Diff
190
patches/dwm-functionalgaps-6.2.diff
Normal file
190
patches/dwm-functionalgaps-6.2.diff
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
diff -pur dwm.git/config.def.h dwm.mygaps/config.def.h
|
||||||
|
--- dwm.git/config.def.h 2021-02-27 21:17:53.862314811 -0600
|
||||||
|
+++ dwm.mygaps/config.def.h 2021-02-28 00:06:39.066149441 -0600
|
||||||
|
@@ -2,6 +2,8 @@
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
+static const int startwithgaps = 0; /* 1 means gaps are used by default */
|
||||||
|
+static const unsigned int gappx = 10; /* default gap between windows in pixels */
|
||||||
|
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 */
|
||||||
|
@@ -84,6 +86,10 @@ 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 = -5 } },
|
||||||
|
+ { MODKEY, XK_equal, setgaps, {.i = +5 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_minus, setgaps, {.i = GAP_RESET } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = GAP_TOGGLE} },
|
||||||
|
TAGKEYS( XK_1, 0)
|
||||||
|
TAGKEYS( XK_2, 1)
|
||||||
|
TAGKEYS( XK_3, 2)
|
||||||
|
diff -pur dwm.git/dwm.c dwm.mygaps/dwm.c
|
||||||
|
--- dwm.git/dwm.c 2021-02-27 21:17:53.862314811 -0600
|
||||||
|
+++ dwm.mygaps/dwm.c 2021-02-28 00:23:19.232865766 -0600
|
||||||
|
@@ -57,6 +57,9 @@
|
||||||
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||||
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||||
|
|
||||||
|
+#define GAP_TOGGLE 100
|
||||||
|
+#define GAP_RESET 0
|
||||||
|
+
|
||||||
|
/* enums */
|
||||||
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
|
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||||
|
@@ -119,6 +122,8 @@ 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 */
|
||||||
|
+ int drawwithgaps; /* toggle gaps */
|
||||||
|
unsigned int seltags;
|
||||||
|
unsigned int sellt;
|
||||||
|
unsigned int tagset[2];
|
||||||
|
@@ -200,6 +205,7 @@ static void sendmon(Client *c, Monitor *
|
||||||
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setfocus(Client *c);
|
||||||
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
+static void setgaps(const Arg *arg);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setup(void);
|
||||||
|
@@ -639,6 +645,8 @@ createmon(void)
|
||||||
|
m->nmaster = nmaster;
|
||||||
|
m->showbar = showbar;
|
||||||
|
m->topbar = topbar;
|
||||||
|
+ m->gappx = gappx;
|
||||||
|
+ m->drawwithgaps = startwithgaps;
|
||||||
|
m->lt[0] = &layouts[0];
|
||||||
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
|
@@ -797,6 +805,12 @@ focus(Client *c)
|
||||||
|
attachstack(c);
|
||||||
|
grabbuttons(c, 1);
|
||||||
|
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
||||||
|
+ if (!selmon->drawwithgaps && !c->isfloating) {
|
||||||
|
+ XWindowChanges wc;
|
||||||
|
+ wc.sibling = selmon->barwin;
|
||||||
|
+ wc.stack_mode = Below;
|
||||||
|
+ XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc);
|
||||||
|
+ }
|
||||||
|
setfocus(c);
|
||||||
|
} else {
|
||||||
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
|
@@ -1113,7 +1127,10 @@ monocle(Monitor *m)
|
||||||
|
if (n > 0) /* override layout symbol */
|
||||||
|
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||||
|
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
||||||
|
- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
+ if (selmon->drawwithgaps)
|
||||||
|
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
|
+ else
|
||||||
|
+ resize(c, m->wx - c->bw, m->wy, m->ww, m->wh, False);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -1283,6 +1300,15 @@ resizeclient(Client *c, int x, int y, in
|
||||||
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
|
wc.border_width = c->bw;
|
||||||
|
+ if (!selmon->drawwithgaps && /* this is the noborderfloatingfix patch, slightly modified so that it will work if, and only if, gaps are disabled. */
|
||||||
|
+ (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) /* these two first lines are the only ones changed. if you are manually patching and have noborder installed already, just change these lines; or conversely, just remove this section if the noborder patch is not desired ;) */
|
||||||
|
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange))
|
||||||
|
+ && !c->isfullscreen && !c->isfloating
|
||||||
|
+ && NULL != c->mon->lt[c->mon->sellt]->arrange) {
|
||||||
|
+ c->w = wc.width += c->bw * 2;
|
||||||
|
+ c->h = wc.height += c->bw * 2;
|
||||||
|
+ wc.border_width = 0;
|
||||||
|
+ }
|
||||||
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
|
configure(c);
|
||||||
|
XSync(dpy, False);
|
||||||
|
@@ -1499,6 +1525,26 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+setgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ switch(arg->i)
|
||||||
|
+ {
|
||||||
|
+ case GAP_TOGGLE:
|
||||||
|
+ selmon->drawwithgaps = !selmon->drawwithgaps;
|
||||||
|
+ break;
|
||||||
|
+ case GAP_RESET:
|
||||||
|
+ selmon->gappx = gappx;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ if (selmon->gappx + arg->i < 0)
|
||||||
|
+ selmon->gappx = 0;
|
||||||
|
+ else
|
||||||
|
+ selmon->gappx += arg->i;
|
||||||
|
+ }
|
||||||
|
+ arrange(selmon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
setlayout(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||||
|
@@ -1680,23 +1726,42 @@ tile(Monitor *m)
|
||||||
|
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 = my = ty = 0, 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);
|
||||||
|
- } 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);
|
||||||
|
- }
|
||||||
|
+ if (m->drawwithgaps) { /* draw with fullgaps logic */
|
||||||
|
+ if (n > m->nmaster)
|
||||||
|
+ mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
+ else
|
||||||
|
+ mw = m->ww - m->gappx;
|
||||||
|
+ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ if (i < m->nmaster) {
|
||||||
|
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||||
|
+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||||
|
+ if (my + HEIGHT(c) + m->gappx < m->wh)
|
||||||
|
+ my += HEIGHT(c) + m->gappx;
|
||||||
|
+ } else {
|
||||||
|
+ h = (m->wh - ty) / (n - i) - m->gappx;
|
||||||
|
+ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||||
|
+ if (ty + HEIGHT(c) + m->gappx < m->wh)
|
||||||
|
+ ty += HEIGHT(c) + m->gappx;
|
||||||
|
+ }
|
||||||
|
+ } else { /* draw with singularborders logic */
|
||||||
|
+ if (n > m->nmaster)
|
||||||
|
+ mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
+ else
|
||||||
|
+ mw = m->ww;
|
||||||
|
+ for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ if (i < m->nmaster) {
|
||||||
|
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||||
|
+ if (n == 1)
|
||||||
|
+ resize(c, m->wx - c->bw, m->wy, m->ww, m->wh, False);
|
||||||
|
+ else
|
||||||
|
+ resize(c, m->wx - c->bw, m->wy + my, mw - c->bw, h - c->bw, False);
|
||||||
|
+ my += HEIGHT(c) - c->bw;
|
||||||
|
+ } else {
|
||||||
|
+ h = (m->wh - ty) / (n - i);
|
||||||
|
+ resize(c, m->wx + mw - c->bw, m->wy + ty, m->ww - mw, h - c->bw, False);
|
||||||
|
+ ty += HEIGHT(c) - c->bw;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
101
patches/dwm-r1615-selfrestart.diff
Normal file
101
patches/dwm-r1615-selfrestart.diff
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# HG changeset patch
|
||||||
|
# User Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
|
||||||
|
# Date 1354650884 -7200
|
||||||
|
# Node ID 6c472a21a5887c5295a331c48c4da188ec2c8413
|
||||||
|
# Parent aaab44133a6830c9a00263731d098c01cc1d6fb5
|
||||||
|
selfrestart now magically locates the current dwm (no need to hardcode a path)
|
||||||
|
|
||||||
|
diff -r aaab44133a68 -r 6c472a21a588 config.def.h
|
||||||
|
--- a/config.def.h Tue Dec 04 21:54:44 2012 +0200
|
||||||
|
+++ b/config.def.h Tue Dec 04 21:54:44 2012 +0200
|
||||||
|
@@ -54,6 +54,8 @@
|
||||||
|
static const char *termcmd[] = { "urxvtc", NULL };
|
||||||
|
static const char *filemancmd[] = { "thunar", NULL };
|
||||||
|
|
||||||
|
+#include "selfrestart.c"
|
||||||
|
+
|
||||||
|
static Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY, XK_r, spawn, {.v = dmenucmd } },
|
||||||
|
@@ -89,6 +91,7 @@
|
||||||
|
TAGKEYS( XK_7, 6)
|
||||||
|
TAGKEYS( XK_8, 7)
|
||||||
|
TAGKEYS( XK_9, 8)
|
||||||
|
+ { MODKEY|ShiftMask, XK_r, self_restart, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -108,4 +111,3 @@
|
||||||
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
|
};
|
||||||
|
-
|
||||||
|
diff -r aaab44133a68 -r 6c472a21a588 selfrestart.c
|
||||||
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
||||||
|
+++ b/selfrestart.c Tue Dec 04 21:54:44 2012 +0200
|
||||||
|
@@ -0,0 +1,65 @@
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Magically finds the current's executable path
|
||||||
|
+ *
|
||||||
|
+ * I'm doing the do{}while(); trick because Linux (what I'm running) is not
|
||||||
|
+ * POSIX compilant and so lstat() cannot be trusted on /proc entries
|
||||||
|
+ *
|
||||||
|
+ * @return char* the path of the current executable
|
||||||
|
+ */
|
||||||
|
+char *get_dwm_path(){
|
||||||
|
+ struct stat s;
|
||||||
|
+ int r, length, rate = 42;
|
||||||
|
+ char *path = NULL;
|
||||||
|
+
|
||||||
|
+ if(lstat("/proc/self/exe", &s) == -1){
|
||||||
|
+ perror("lstat:");
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ length = s.st_size + 1 - rate;
|
||||||
|
+
|
||||||
|
+ do{
|
||||||
|
+ length+=rate;
|
||||||
|
+
|
||||||
|
+ free(path);
|
||||||
|
+ path = malloc(sizeof(char) * length);
|
||||||
|
+
|
||||||
|
+ if(path == NULL){
|
||||||
|
+ perror("malloc:");
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ r = readlink("/proc/self/exe", path, length);
|
||||||
|
+
|
||||||
|
+ if(r == -1){
|
||||||
|
+ perror("readlink:");
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+ }while(r >= length);
|
||||||
|
+
|
||||||
|
+ path[r] = '\0';
|
||||||
|
+
|
||||||
|
+ return path;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * self-restart
|
||||||
|
+ *
|
||||||
|
+ * Initially inspired by: Yu-Jie Lin
|
||||||
|
+ * https://sites.google.com/site/yjlnotes/notes/dwm
|
||||||
|
+ */
|
||||||
|
+void self_restart(const Arg *arg) {
|
||||||
|
+ char *const argv[] = {get_dwm_path(), NULL};
|
||||||
|
+
|
||||||
|
+ if(argv[0] == NULL){
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ execv(argv[0], argv);
|
||||||
|
+}
|
235
patches/dwm-xresources-6.2.diff
Normal file
235
patches/dwm-xresources-6.2.diff
Normal file
@ -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
|
||||||
|
|
65
selfrestart.c
Normal file
65
selfrestart.c
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magically finds the current's executable path
|
||||||
|
*
|
||||||
|
* I'm doing the do{}while(); trick because Linux (what I'm running) is not
|
||||||
|
* POSIX compilant and so lstat() cannot be trusted on /proc entries
|
||||||
|
*
|
||||||
|
* @return char* the path of the current executable
|
||||||
|
*/
|
||||||
|
char *get_dwm_path(){
|
||||||
|
struct stat s;
|
||||||
|
int r, length, rate = 42;
|
||||||
|
char *path = NULL;
|
||||||
|
|
||||||
|
if(lstat("/proc/self/exe", &s) == -1){
|
||||||
|
perror("lstat:");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = s.st_size + 1 - rate;
|
||||||
|
|
||||||
|
do{
|
||||||
|
length+=rate;
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
path = malloc(sizeof(char) * length);
|
||||||
|
|
||||||
|
if(path == NULL){
|
||||||
|
perror("malloc:");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = readlink("/proc/self/exe", path, length);
|
||||||
|
|
||||||
|
if(r == -1){
|
||||||
|
perror("readlink:");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}while(r >= length);
|
||||||
|
|
||||||
|
path[r] = '\0';
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* self-restart
|
||||||
|
*
|
||||||
|
* Initially inspired by: Yu-Jie Lin
|
||||||
|
* https://sites.google.com/site/yjlnotes/notes/dwm
|
||||||
|
*/
|
||||||
|
void self_restart(const Arg *arg) {
|
||||||
|
char *const argv[] = {get_dwm_path(), NULL};
|
||||||
|
|
||||||
|
if(argv[0] == NULL){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
execv(argv[0], argv);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user