My configuration of sxmo fork of suckless dwm.

git clone git://watertao.xyz/programs/sxmo-dwm.git

commit 8de4a21879f65e468f01e1d0920ab010811be09a
parent ab1aaf19346098d951a29fc303b5d4310d45da9e
Author: Miles Alan <m@milesalan.com>
Date:   Sat, 25 Apr 2020 08:26:39 -0500

Updates for PBP compatibility

Diffstat:
Mconfig.def.h | 63++++++++++++++++++++++++++++++++++++++++++---------------------
Mdwm.c | 7+++++--
2 files changed, 47 insertions(+), 23 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -5,8 +5,11 @@ 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[] = { "monospace:size=15" }; -static const char dmenufont[] = "monospace:size=15"; +static const char *fonts[] = { + "monospace:size=15", /* PP default start index */ + "monospace:size=11", /* PB default start index */ +}; +static const char dmenufont[] = "monospace:size=11"; static const char col_gray1[] = "#222222"; static const char col_gray2[] = "#444444"; static const char col_gray3[] = "#bbbbbb"; @@ -22,13 +25,7 @@ static const char *colors[][3] = { static const char *tags[] = { "1", "2", "3", "4" }; static const Rule rules[] = { - /* xprop(1): - * WM_CLASS(STRING) = instance, class - * WM_NAME(STRING) = title - */ /* class instance title tags mask isfloating isterminal noswallow monitor */ - { "Gimp", NULL, NULL, 0, 1, 0, 0, -1, 0}, - { "Firefox", NULL, NULL, 1 << 8, 0, 0, 0, -1, 0}, { "st", NULL, NULL, 0, 0, 1, 1, -1, 0}, { "svkbd", NULL, NULL, TAGMASK, 1, 1, 0, -1, 1}, }; @@ -63,27 +60,51 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, #include <X11/XF86keysym.h> static Key keys[] = { - // TODO: hold functionality doesnt work if keybinding starts at 0 index - {0, MODKEY, XK_0, view, {.ui = ~0 } }, - - {0, MODKEY|ShiftMask, XK_h, shiftview, {.i = -1} }, - {0, MODKEY|ShiftMask, XK_l, shiftview, {.i = +1} }, - {0, MODKEY, XK_h, clienttagpush, {.i = -1} }, - {0, MODKEY, XK_l, clienttagpush, {.i = +1} }, - + /* PP */ {1, 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sxmo_appmenu.sh") }, {2, 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sxmo_appmenu.sh sys") }, {3, 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("sxmo_screenlock") }, - {1, 0, XF86XK_AudioLowerVolume, cyclelayout , {.i = +1 } }, {2, 0, XF86XK_AudioLowerVolume, rotatestack, {.i = +1} }, {3, 0, XF86XK_AudioLowerVolume, killclient, {0} }, - {1, 0, XF86XK_PowerOff, spawn, SHCMD("pkill -9 svkbd-sxmo || svkbd-sxmo") }, {2, 0, XF86XK_PowerOff, spawn, SHCMD("sxmo_blinkled.sh green & $TERM") }, - {3, 0, XF86XK_PowerOff, spawn, SHCMD("sxmo_blinkled.sh green & $BROWSER") } - - + {3, 0, XF86XK_PowerOff, spawn, SHCMD("sxmo_blinkled.sh green & $BROWSER") }, + + /* Used by scripts via xdotool */ + {0, MODKEY|ShiftMask, XK_e, shiftview, {.i = -1} }, + {0, MODKEY|ShiftMask, XK_r, shiftview, {.i = +1} }, + {0, MODKEY, XK_e, clienttagpush, {.i = -1} }, + {0, MODKEY, XK_r, clienttagpush, {.i = +1} }, + + /* PBP */ + { 0, MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { 0, MODKEY|ShiftMask, XK_Return, spawn, SHCMD("st") }, + { 0, MODKEY, XK_b, togglebar, {0} }, + { 0, MODKEY, XK_j, focusstack, {.i = +1 } }, + { 0, MODKEY, XK_k, focusstack, {.i = -1 } }, + { 0, MODKEY, XK_i, incnmaster, {.i = +1 } }, + { 0, MODKEY, XK_o, incnmaster, {.i = -1 } }, + { 0, MODKEY, XK_h, setmfact, {.f = -0.05} }, + { 0, MODKEY, XK_l, setmfact, {.f = +0.05} }, + { 0, MODKEY, XK_Return, zoom, {0} }, + { 0, MODKEY, XK_Tab, view, {0} }, + { 0, MODKEY|ShiftMask, XK_c, killclient, {0} }, + { 0, MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { 0, MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { 0, MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { 0, MODKEY, XK_space, setlayout, {0} }, + { 0, MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { 0, MODKEY, XK_0, view, {.ui = ~0 } }, + { 0, MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { 0, MODKEY, XK_comma, focusmon, {.i = -1 } }, + { 0, MODKEY, XK_period, focusmon, {.i = +1 } }, + { 0, MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { 0, MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) }; /* button definitions */ diff --git a/dwm.c b/dwm.c @@ -1089,7 +1089,7 @@ grabkeys(void) void incnmaster(const Arg *arg) { - selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); + selmon->nmaster = MAX(selmon->nmaster + arg->i, 1); arrange(selmon); } @@ -1800,7 +1800,10 @@ setup(void) sh = DisplayHeight(dpy, screen); root = RootWindow(dpy, screen); drw = drw_create(dpy, screen, root, sw, sh); - if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) + + int fontoffset = sw > 1000 ? 1 : 0; + fprintf(stderr, "WIDTH %d %d\n", sw, fontoffset); + if (!drw_fontset_create(drw, fonts + fontoffset, LENGTH(fonts) - fontoffset)) die("no fonts could be loaded."); lrpad = drw->fonts->h; bh = drw->fonts->h + 2;