commit: 2ede184ff4e796a402b3ced5a578cc7a26d61306
parent: f9a77840a324aaa65c8ebd1bddb9962a502e60d6
author: Chris Noxz <chris@noxz.tech>
date: Tue, 31 Mar 2020 20:56:45 +0200
remove unused functions, references and configurations
2 files changed, 54 insertions(+), 171 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -1,5 +1,6 @@
/* See LICENSE file for copyright and license details. */
#define COL_DEF "#000000"
+#define MODKEY Mod4Mask
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
@@ -8,42 +9,36 @@ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const int viewontag = 1;
static const int focusonwheel = 0;
-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 *fonts[] = { "dnoxz_numerics:pixelsize=12:autohint=false" };
static const char title_bg_dark[] = "#030303";
static const char title_bg_light[] = "#fdfdfd";
static const int color_ptrs[][4] = {
/* fg bg border float */
- [SchemeNorm] = { -1, -1, 5, 5 },
- [SchemeSel] = { -1, -1, 11, 9 },
- [SchemeTagsNorm] = { 2, 0, 0, -1 },
- [SchemeTagsSel] = { 6, 5, 5, -1 },
- [SchemeTitleNorm] = { 6, -1, -1, -1 },
- [SchemeTitleSel] = { 6, -1, -1, -1 },
+ [SchemeNorm] = { -1, -1, 5, 5 },
+ [SchemeSel] = { -1, -1, 11, 9 },
+ [SchemeTagsNorm] = { 2, 0, 0, -1 },
+ [SchemeTagsSel] = { 6, 5, 5, -1 },
+ [SchemeTitleNorm] = { 6, -1, -1, -1 },
+ [SchemeTitleSel] = { 6, -1, -1, -1 },
- [SchemeStatusNorm] = { 2, 0, -1, -1 },
- [SchemeStatusAct] = { 6, 0, -1, -1 },
- [SchemeStatusDist] = { 11, 0, -1, -1 },
- [SchemeStatusNoti] = { 0, 6, -1, -1 },
+ [SchemeStatusNorm] = { 6, -1, -1, -1 },
+ [SchemeStatusAct] = { 6, 5, -1, -1 },
+ [SchemeStatusDist] = { 11, 0, -1, -1 },
+ [SchemeStatusNoti] = { 0, 6, -1, -1 },
};
-static char colors[][4][8] = {
- /* fg bg border float */
- [SchemeNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeTagsNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeTagsSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeTitleNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeTitleSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+static char colors[][4][8] = {
+ /* fg bg border float */
+ [SchemeNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeTagsNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeTagsSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeTitleNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeTitleSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeStatusNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeStatusAct] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeStatusDist] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeStatusNoti] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeStatusNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeStatusAct] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeStatusDist] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeStatusNoti] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
};
/* tagging */
@@ -51,12 +46,12 @@ 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
+ * 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 },
+ { "tabbed", "vimb", NULL, 1 << 1, 0, -1 },
};
/* layout(s) */
@@ -66,81 +61,28 @@ static const int resizehints = 0; /* 1 means respect size hints in til
static const Layout layouts[] = {
/* symbol arrange function */
- [LayoutGrid] = { "###", nrowgrid }, /* default */
- [LayoutTiled] = { "[]=", tile },
- [LayoutMonocle] = { "[M]", monocle },
- [LayoutFloating] = { "><>", NULL }, /* no layout function means floating behavior */
-};
-
-/* key definitions */
-#define MODKEY Mod1Mask
-#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 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[1]} },
- { MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
- { MODKEY, XK_m, setlayout, {.v = &layouts[3]} },
- { MODKEY, XK_g, setlayout, {.v = &layouts[0]} },
- { 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_q, quit, {0} },
+ [LayoutGrid] = { "\uE026\uE027",nrowgrid }, /* default */
+ [LayoutTiled] = { "\uE020\uE021",tile },
+ [LayoutMonocle] = { "\uE024\uE025",monocle },
+ [LayoutFloating] = { "\uE022\uE023",NULL }, /* no layout function means floating behavior */
};
/* 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[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} },
+ /* click event mask button function argument */
+ { ClkLtSymbol, 0, Button1, rotatelayout, {.i = +1 } },
+ { ClkLtSymbol, 0, Button3, rotatelayout, {.i = -1 } },
+ { ClkClientWin, Mod4Mask, Button4, rotatestack, {.i = +1 } },
+ { ClkClientWin, Mod4Mask, Button5, rotatestack, {.i = -1 } },
+ { ClkWinTitle, 0, Button2, zoom, {0} },
+ { ClkClientWin, Mod4Mask, Button1, movemouse, {0} },
+ { ClkClientWin, Mod4Mask, Button2, togglefloating, {0} },
+ { ClkClientWin, Mod4Mask, Button3, resizemouse, {0} },
+ { ClkTagBar, 0, Button1, view, {0} },
+ { ClkTagBar, 0, Button3, toggleview, {0} },
+ { ClkTagBar, Mod4Mask, Button1, tag, {0} },
+ { ClkTagBar, Mod4Mask, Button3, toggletag, {0} },
};
static const char *dwmfifo = "/tmp/dwm.fifo";
@@ -160,23 +102,23 @@ static Command commands[] = {
{ "set mfact -", setmfact, {.f = -0.05} },
{ "zoom", zoom, {0} },
{ "kill client", killclient, {0} },
-
+
{ "set layout grid", setlayout, {.v = &layouts[LayoutGrid]} },
{ "set layout tiled", setlayout, {.v = &layouts[LayoutTiled]} },
- { "set layout float", setlayout, {.v = &layouts[LayoutFloating]} },
+ { "set layout floating",setlayout, {.v = &layouts[LayoutFloating]} },
{ "set layout monocle", setlayout, {.v = &layouts[LayoutMonocle]} },
{ "toggle monocle", togglelayout, {.v = &layouts[LayoutMonocle]} },
{ "toggle layout", setlayout, {0} },
{ "rotate layout +", rotatelayout, {.i = +1} },
{ "rotate layout -", rotatelayout, {.i = -1} },
-
+
{ "toggle floating", togglefloating, {0} },
{ "toggle sticky", togglesticky, {0} },
{ "focus mon +", focusmon, {.i = +1} },
{ "focus mon -", focusmon, {.i = -1} },
{ "tag mon +", tagmon, {.i = +1} },
{ "tag mon -", tagmon, {.i = -1} },
-
+
{ "view", view, {0} },
{ "view all", view, {.ui = ~0} },
{ "tag all", tag, {.ui = ~0} },
diff --git a/dwm.c b/dwm.c
@@ -105,13 +105,6 @@ struct Client {
Window win;
};
-typedef struct {
- unsigned int mod;
- KeySym keysym;
- void (*func)(const Arg *);
- const Arg arg;
-} Key;
-
typedef struct {
const char *symbol;
void (*arrange)(Monitor *);
@@ -191,12 +184,9 @@ static int getrootptr(int *x, int *y);
static long getstate(Window w);
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
-static void grabkeys(void);
static void incnmaster(const Arg *arg);
-static void keypress(XEvent *e);
static void killclient(const Arg *arg);
static void manage(Window w, XWindowAttributes *wa);
-static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static void monocle(Monitor *m);
static void movemouse(const Arg *arg);
@@ -276,8 +266,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[DestroyNotify] = destroynotify,
[Expose] = expose,
[FocusIn] = focusin,
- [KeyPress] = keypress,
- [MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
[PropertyNotify] = propertynotify,
[UnmapNotify] = unmapnotify
@@ -896,13 +884,13 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
+ drw_rect(drw, x + boxs + 1, boxs + 1, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
- drw_setscheme(drw, scheme[SchemeTagsNorm]);
+ drw_setscheme(drw, scheme[SchemeTagsSel]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - sw - x) > bh) {
@@ -911,10 +899,10 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
if (m->sel->isfloating)
- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
+ drw_rect(drw, x + boxs + 1, boxs + 1, boxw, boxw, m->sel->isfixed, 0);
} else {
drw_setscheme(drw, scheme[SchemeTitleNorm]);
- drw_rect(drw, x, 0, w, bh, 1, 1);
+ drw_rect(drw, x + 1, 1, w, bh, 1, 1);
}
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
@@ -1135,24 +1123,6 @@ grabbuttons(Client *c, int focused)
}
}
-void
-grabkeys(void)
-{
- updatenumlockmask();
- {
- unsigned int i, j;
- unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
- KeyCode code;
-
- XUngrabKey(dpy, AnyKey, AnyModifier, root);
- for (i = 0; i < LENGTH(keys); i++)
- if ((code = XKeysymToKeycode(dpy, keys[i].keysym)))
- for (j = 0; j < LENGTH(modifiers); j++)
- XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
- True, GrabModeAsync, GrabModeAsync);
- }
-}
-
void
incnmaster(const Arg *arg)
{
@@ -1172,22 +1142,6 @@ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
}
#endif /* XINERAMA */
-void
-keypress(XEvent *e)
-{
- unsigned int i;
- KeySym keysym;
- XKeyEvent *ev;
-
- ev = &e->xkey;
- keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
- for (i = 0; i < LENGTH(keys); i++)
- if (keysym == keys[i].keysym
- && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
- && keys[i].func)
- keys[i].func(&(keys[i].arg));
-}
-
void
killclient(const Arg *arg)
{
@@ -1271,16 +1225,6 @@ manage(Window w, XWindowAttributes *wa)
focus(NULL);
}
-void
-mappingnotify(XEvent *e)
-{
- XMappingEvent *ev = &e->xmapping;
-
- XRefreshKeyboardMapping(ev);
- if (ev->request == MappingKeyboard)
- grabkeys();
-}
-
void
maprequest(XEvent *e)
{
@@ -1939,8 +1883,8 @@ setup(void)
drw = drw_create(dpy, screen, root, sw, sh);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
- lrpad = drw->fonts->h;
- bh = drw->fonts->h + 2;
+ lrpad = drw->fonts->h + 4;
+ bh = drw->fonts->h + 2 + 4;
updategeom();
/* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
@@ -1995,7 +1939,6 @@ setup(void)
|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
- grabkeys();
focus(NULL);
/* fifo */
@@ -2047,8 +1990,6 @@ sigchld(int unused)
void
spawn(const Arg *arg)
{
- if (arg->v == dmenucmd)
- dmenumon[0] = '0' + selmon->num;
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));