Re: [hackers] [dwm] my custom config || Daniel Cousens

From: Anselm Garbe <garbeam_AT_gmail.com>
Date: Wed, 11 Oct 2017 10:26:55 +0200

Please ignore, already dropped.

On 11 October 2017 at 09:19, <git_AT_suckless.org> wrote:
> commit 6dea1bd99f97fc341f126c99bc1c61053a029908
> Author: Daniel Cousens <github_AT_dcousens.com>
> AuthorDate: Fri Apr 21 12:57:37 2017 +1000
> Commit: Daniel Cousens <github_AT_dcousens.com>
> CommitDate: Wed Oct 11 07:48:07 2017 +1100
>
> my custom config
>
> diff --git a/config.def.h b/config.def.h
> index a9ac303..74b8b60 100644
> --- a/config.def.h
> +++ b/config.def.h
> _AT_@ -1,25 +1,30 @@
> -/* See LICENSE file for copyright and license details. */
> +#define FONT "monospace:size=10:antialias=true:autohint=false"
>
> /* appearance */
> -static const unsigned int borderpx = 1; /* border pixel of windows */
> +static const unsigned int borderpx = 0; /* 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[] = { "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[] = { FONT, "ionicons:size=10:antialias=true:autohint=false", "material\\-wifi:size=10:antialias=true:autohint=false" };
> +static const char dmenufont[] = FONT;
> +static const char col_bg1[] = "#20262b";
> +static const char col_bg2[] = "#191d21";
> +static const char col_bg3[] = "#16191d";
> +static const char col_border[] = "#000000";
> +static const char col_fg1[] = "#aaaaaa";
> +static const char col_fg2[] = "#eeeeee";
> +static const char col_fg3[] = "#232a2f";
> static const char *colors[][3] = {
> /* fg bg border */
> - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
> - [SchemeSel] = { col_gray4, col_cyan, col_cyan },
> + [SchemeFaded] = { col_fg3, col_bg3, col_border },
> + [SchemeNorm] = { col_fg1, col_bg2, col_border },
> + [SchemeSel] = { col_fg2, col_bg1, col_bg2 },
> + [SchemeStatus] = { col_fg1, col_bg3, col_border },
> + [SchemeStatusTitle] = { col_fg2, col_bg3, col_border },
> };
>
> /* tagging */
> -static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
> +static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=" };
>
> static const Rule rules[] = {
> /* xprop(1):
> _AT_@ -27,89 +32,67 @@ static const Rule rules[] = {
> * WM_NAME(STRING) = title
> */
> /* class instance title tags mask isfloating monitor */
> - { "Gimp", NULL, NULL, 0, 1, -1 },
> - { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
> + { "Gimp", NULL, NULL, 0, 1, -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 Layout layouts[] = {
> /* symbol arrange function */
> - { "[]=", tile }, /* first entry is default */
> - { "><>", NULL }, /* no layout function means floating behavior */
> - { "[M]", monocle },
> + { "", tile } /* first entry is default */
> };
>
> +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 = 0; /* 1 means respect size hints in tiled resizals */
> +
> /* 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 } }
> + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
> + { MODKEY|ControlMask, KEY, tag, {.ui = 1 << TAG} }, \
> + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} },
>
> /* 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", col_bg3, "-nf", col_fg1, "-sb", col_bg2, "-sf", col_fg2, 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[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_q, quit, {0} },
> + /* modifier key function argument */
> + { MODKEY, XK_p, spawn, {.v = dmenucmd } },
> + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
> + { MODKEY|ShiftMask, XK_b, togglebar, {0} },
> + { MODKEY, XK_j, focusstack, {.i = +1 } },
> + { MODKEY, XK_k, focusstack, {.i = -1 } },
> + { MODKEY, XK_h, setmfact, {.f = -0.05} },
> + { MODKEY, XK_l, setmfact, {.f = +0.05} },
> + { MODKEY, XK_d, incnmaster, {.i = -1 } },
> + { MODKEY, XK_i, incnmaster, {.i = +1 } },
> + { MODKEY, XK_Return, zoom, {0} },
> + { MODKEY|ShiftMask, XK_c, killclient, {0} },
> + { MODKEY|ShiftMask|ControlMask, XK_F9, restart, {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)
> + TAGKEYS(XK_0, 9)
> + TAGKEYS(XK_minus, 10)
> + TAGKEYS(XK_equal, 11)
> };
>
> /* button definitions */
> /* click can be 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} },
> + { ClkWinTitle, 0, Button2, zoom, {0} }
> };
> -
> diff --git a/dwm.c b/dwm.c
> index a5ce993..fd564e0 100644
> --- a/dwm.c
> +++ b/dwm.c
> _AT_@ -60,7 +60,7 @@
>
> /* enums */
> enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
> -enum { SchemeNorm, SchemeSel }; /* color schemes */
> +enum { SchemeFaded, SchemeNorm, SchemeSel, SchemeStatus, SchemeStatusTitle }; /* color schemes */
> enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
> NetWMFullscreen, NetActiveWindow, NetWMWindowType,
> NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
> _AT_@ -233,6 +233,7 @@ static Monitor *wintomon(Window w);
> static int xerror(Display *dpy, XErrorEvent *ee);
> static int xerrordummy(Display *dpy, XErrorEvent *ee);
> static int xerrorstart(Display *dpy, XErrorEvent *ee);
> +static void restart(const Arg *arg);
> static void zoom(const Arg *arg);
>
> /* variables */
> _AT_@ -704,7 +705,7 @@ drawbar(Monitor *m)
>
> /* draw status first so it can be overdrawn by tags later */
> if (m == selmon) { /* status is only drawn on selected monitor */
> - drw_setscheme(drw, scheme[SchemeNorm]);
> + drw_setscheme(drw, scheme[SchemeStatus]);
> sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
> drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
> }
> _AT_@ -717,7 +718,12 @@ drawbar(Monitor *m)
> x = 0;
> for (i = 0; i < LENGTH(tags); i++) {
> w = TEXTW(tags[i]);
> - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
> + if (m->tagset[m->seltags] & 1 << i)
> + drw_setscheme(drw, scheme[SchemeSel]);
> + else if (occ & 1 << i)
> + drw_setscheme(drw, scheme[SchemeNorm]);
> + else
> + drw_setscheme(drw, scheme[SchemeFaded]);
> 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,
> _AT_@ -726,12 +732,12 @@ drawbar(Monitor *m)
> x += w;
> }
> w = blw = TEXTW(m->ltsymbol);
> - drw_setscheme(drw, scheme[SchemeNorm]);
> + drw_setscheme(drw, scheme[SchemeStatusTitle]);
> x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
>
> if ((w = m->ww - sw - x) > bh) {
> if (m->sel) {
> - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
> + drw_setscheme(drw, scheme[m == selmon ? SchemeStatusTitle : SchemeFaded]);
> drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
> if (m->sel->isfloating)
> drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
> _AT_@ -2125,6 +2131,15 @@ zoom(const Arg *arg)
> pop(c);
> }
>
> +void
> +restart(const Arg *arg) {
> + if (arg->v) {
> + execvp(((char **)arg->v)[0], (char **)arg->v);
> + } else {
> + execlp("dwm", "dwm", NULL);
> + }
> +}
> +
> int
> main(int argc, char *argv[])
> {
>
Received on Wed Oct 11 2017 - 10:26:55 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 11 2017 - 10:37:27 CEST