My configuration of sxmo fork of suckless dwm.

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

commit 16621f20e4dcb454842d2e716d2d3bf2b5926551
parent 738d3b736c3a8267cdc1716695601ef5e1d5b49c
Author: Mobile Jeff <dev@watertao.xyz>
Date:   Tue, 10 Feb 2026 20:35:31 -0800

Applied patches borderrule and singularborders

Adapted bstack tiling mode to singularborders.

Deleted bstackhoriz as "tile" tiling mode replaces it nicely.

Custom keybinds and color edits to config.def.h.

All of this working beautifully on pinephone 1.2

Diffstat:
MREADME.md | 15+++++++++++++++
Mconfig.def.h | 76++++++++++++++++++++++++++++++++++++++++++++++------------------------------
Mdwm.c | 79+++++++++++++++++++++++--------------------------------------------------------
3 files changed, 84 insertions(+), 86 deletions(-)

diff --git a/README.md b/README.md @@ -5,6 +5,21 @@ dwm - dynamic window manager dwm is an extremely fast, small, and dynamic window manager for X. +Description +----------- +My configuration of sxmo fork of suckless dwm. + +Applied patches borderrule and singularborders. + +Adapted bstack tiling mode to singularborders. + +Deleted bstackhoriz as "tile" tiling mode replaces it nicely. + +Custom keybinds and color edits to config.def.h. + +All of this working beautifully on pinephone 1.2 + + Requirements ------------ In order to build dwm you need the Xlib header files. diff --git a/config.def.h b/config.def.h @@ -5,17 +5,17 @@ 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 font[] = "Sxmo 10"; -static const char dmenufont[] = "Sxmo:size=11"; +static const char font[] = "Terminess Nerd Font 10"; +static const char dmenufont[] = "Terminess Nerd Font: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 *defaultcolors[][3] = { +static const char col_cyan[] = "#00c1f3"; +static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + [SchemeSel] = { col_gray1, col_cyan, col_cyan }, [SchemeTabActive] = { col_gray2, col_gray3, col_gray2 }, [SchemeTabInactive] = { col_gray1, col_gray3, col_gray1 } }; @@ -27,9 +27,9 @@ static const int attachbelow = 1; static const char *tags[] = { "1", "2", "3", "4" }; static const Rule rules[] = { - /* class instance title tags mask isfloating isterminal noswallow monitor */ - { "st", NULL, NULL, 0, 0, 1, 1, -1, 0}, - { "svkbd", NULL, NULL, TAGMASK, 1, 1, 0, -1, 1}, + /* class instance title tags mask isfloating isterminal noswallow monitor borderwidth*/ + { "st", NULL, NULL, 0, 0, 1, 1, -1, 0, -1}, + { "svkbd", NULL, NULL, TAGMASK, 1, 1, 0, -1, 1, 0}, }; /* layout(s) */ @@ -56,16 +56,16 @@ static const Layout ppcyclelayouts[] = { static const Layout layouts[] = { /* symbol arrange function */ - { "", bstack }, /* first entry is default */ + { "", monocle }, /* first entry is default */ + { "", bstack }, { "", tile }, { "F", NULL }, - { "", monocle }, { "DD", deckdouble}, { "D", deck}, }; /* key definitions */ -#define MODKEY Mod4Mask +#define MODKEY Mod1Mask #define TAGKEYS(KEY,TAG) \ { KeyPress, MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { KeyPress, MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ @@ -97,25 +97,42 @@ static Key keys[] = { #endif /* Used by scripts via xdotool */ - { KeyPress, MODKEY|ShiftMask, XK_e, shiftview, {.i = -1} }, - { KeyPress, MODKEY|ShiftMask, XK_r, shiftview, {.i = +1} }, - { KeyPress, MODKEY, XK_e, clienttagpush, {.i = -1} }, - { KeyPress, MODKEY, XK_r, clienttagpush, {.i = +1} }, + { KeyPress, MODKEY, XK_h, shiftview, {.i = -1} }, + { KeyPress, MODKEY, XK_l, shiftview, {.i = +1} }, + /* + { KeyPress, MODKEY|ShiftMask, XK_h, clienttagpush, {.i = -1} }, + { KeyPress, MODKEY|ShiftMask, XK_l, clienttagpush, {.i = +1} }, + */ /* PBP */ - { KeyPress, MODKEY, XK_p, spawn, SHCMD("sxmo_appmenu.sh") }, - { KeyPress, MODKEY, XK_d, spawn, SHCMD("sxmo_files.sh") }, - { KeyPress, MODKEY|ShiftMask, XK_Return, spawn, SHCMD("st") }, - { KeyPress, MODKEY, XK_b, togglebar, {0} }, + { KeyPress, MODKEY, XK_Return, spawn, SHCMD("sxmo_appmenu.sh main") }, + { KeyPress, MODKEY, XK_a, spawn, SHCMD("sxmo_audio.sh") }, + { KeyPress, MODKEY, XK_b, spawn, SHCMD("sxmo_bluetoothmenu.sh") }, + { KeyPress, MODKEY|ShiftMask, XK_b, togglebar, {0} }, + { KeyPress, MODKEY, XK_c, spawn, SHCMD("~/l/progs/calcurse_dmenu/calcurse_dmenu.sh") }, + { KeyPress, MODKEY|ShiftMask, XK_c, spawn, SHCMD("sxmo_contactmenu.sh") }, + { KeyPress, MODKEY, XK_d, spawn, SHCMD("sxmo_modemdial.sh") }, + { KeyPress, MODKEY, XK_e, spawn, SHCMD("st tao_fetchmail.sh") }, + { KeyPress, MODKEY, XK_f, spawn, SHCMD("st lf") }, { KeyPress, MODKEY, XK_j, focusstack, {.i = +1 } }, { KeyPress, MODKEY, XK_k, focusstack, {.i = -1 } }, { KeyPress, MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } }, { KeyPress, MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } }, + { KeyPress, MODKEY, XK_m, spawn, SHCMD("st mutt -y") }, + { KeyPress, MODKEY, XK_n, spawn, SHCMD("tao_notes.sh") }, + { KeyPress, MODKEY, XK_o, spawn, SHCMD("tao_url.sh -r") }, + { KeyPress, MODKEY, XK_p, spawn, SHCMD("sxmo_appmenu.sh power") }, + { KeyPress, MODKEY, XK_r, spawn, SHCMD("st newsraft") }, + { KeyPress, MODKEY, XK_s, spawn, SHCMD("tao_url.sh -r -q") }, + { KeyPress, MODKEY, XK_t, spawn, SHCMD("st") }, + { KeyPress, MODKEY, XK_v, spawn, SHCMD("~/.config/sxmo/userscripts/music.sh") }, + { KeyPress, MODKEY, XK_x, inplacerotate, {.i = +2 } }, + { KeyPress, MODKEY, XK_slash, spawn, SHCMD("sxmo_modemtext.sh") }, { KeyPress, 0, XF86XK_MonBrightnessUp, spawn, SHCMD("sxmo_brightness.sh up") }, { KeyPress, 0, XF86XK_MonBrightnessDown, spawn, SHCMD("sxmo_brightness.sh down") }, { KeyPress, MODKEY|ShiftMask, XK_Down, spawn, SHCMD("sxmo_audio.sh vol down") }, @@ -123,30 +140,29 @@ static Key keys[] = { { KeyPress, MODKEY, XK_i, incnmaster, {.i = +1 } }, { KeyPress, MODKEY, XK_o, incnmaster, {.i = -1 } }, - { KeyPress, MODKEY, XK_h, setmfact, {.f = -0.05} }, - { KeyPress, MODKEY, XK_l, setmfact, {.f = +0.05} }, - { KeyPress, MODKEY, XK_Return, zoom, {0} }, + { KeyPress, MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.05} }, + { KeyPress, MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.05} }, + { KeyPress, MODKEY|ShiftMask, XK_Return, zoom, {0} }, { KeyPress, MODKEY, XK_Tab, view, {0} }, - { KeyPress, MODKEY|ShiftMask, XK_c, killclient, {0} }, - { KeyPress, MODKEY|ShiftMask, XK_q, killclient, {0} }, + { KeyPress, MODKEY, XK_q, killclient, {0} }, { KeyPress, MODKEY|ShiftMask, XK_q, killclient, {0} }, { KeyPress, MODKEY, XK_semicolon, switchcol, {0} }, - { KeyPress, MODKEY, XK_s, transfer, {0} }, - { KeyPress, MODKEY, XK_s, transferall, {0} }, + { KeyPress, MODKEY|ShiftMask, XK_s, transfer, {0} }, + { KeyPress, MODKEY|ShiftMask, XK_s, transferall, {0} }, /* monocle */ - { KeyPress, MODKEY, XK_m, setlayout, {.v = &layouts[3]} }, + { KeyPress, MODKEY|ShiftMask, XK_m, setlayout, {.v = &layouts[3]} }, /* tile */ - { KeyPress, MODKEY, XK_slash, setlayout, {.v = &layouts[1]} }, + /* { KeyPress, MODKEY, XK_slash, setlayout, {.v = &layouts[1]} },*/ /* bstack */ { KeyPress, MODKEY|ShiftMask, XK_slash, setlayout, {.v = &layouts[0]} }, - { KeyPress, MODKEY, XK_f, togglefloating, {0} }, - { KeyPress, MODKEY|ShiftMask, XK_f, unfloatvisible, {0} }, + { KeyPress, MODKEY|ShiftMask, XK_f, togglefloating, {0} }, + { KeyPress, MODKEY|ShiftMask|ControlMask, XK_f, unfloatvisible, {0} }, /* cycle through the layouts in ppcyclelayouts */ { KeyPress, MODKEY, XK_space, cyclelayout, {.i = +1} }, diff --git a/dwm.c b/dwm.c @@ -34,6 +34,7 @@ #include <X11/keysym.h> #include <X11/Xatom.h> #include <X11/Xlib.h> +#include <X11/XKBlib.h> #include <X11/Xproto.h> #include <X11/Xutil.h> #ifdef XINERAMA @@ -155,6 +156,7 @@ typedef struct { int noswallow; int monitor; int iskbd; + int bw; } Rule; /* function declarations */ @@ -260,7 +262,6 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); static void bstack(Monitor *m); -static void bstackhoriz(Monitor *m); static void clienttagpush(const Arg *arg); static void shiftview(const Arg *arg); static void pushup(const Arg *arg); @@ -273,6 +274,8 @@ static Client *swallowingclient(Window w); static Client *termforwin(const Client *c); static pid_t winpid(Window w); +static int iswide(void); + /* variables */ static const char broken[] = "broken"; @@ -310,7 +313,7 @@ static Monitor *mons, *selmon; static Window root, wmcheckwin; /* Empty arrays to be filled from command line, Xresources, and defaults, in decreasing order of precedence */ -static char *colors[4][3]; /* 4 schemes, 3 colors each */ +/* static char *colors[4][3]; 4 schemes, 3 colors each */ static xcb_connection_t *xcon; @@ -335,6 +338,7 @@ applyrules(Client *c) /* rule matching */ c->isfloating = 0; c->tags = 0; + c->bw = borderpx; XGetClassHint(dpy, c->win, &ch); class = ch.res_class ? ch.res_class : broken; instance = ch.res_name ? ch.res_name : broken; @@ -349,6 +353,8 @@ applyrules(Client *c) c->isfloating = r->isfloating; c->iskbd = r->iskbd; c->tags |= r->tags; + if (r->bw != -1) + c->bw = r->bw; for (m = mons; m && m->num != r->monitor; m = m->next); if (m) c->mon = m; @@ -1446,7 +1452,6 @@ manage(Window w, XWindowAttributes *wa) c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); } - c->bw = borderpx; wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); @@ -1518,7 +1523,7 @@ 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); + resize(c, m->wx - c->bw, m->wy - c->bw, m->ww, m->wh, 0); } void @@ -1951,13 +1956,6 @@ setup(void) drw = drw_create(dpy, screen, root, sw, sh); readxresources(); - /* Apply defaults to font and colors*/ - for (i = 0; i <= SchemeTabInactive; ++i){ - for (j = 0; j <= ColBorder; ++j){ - if ( !colors[i][j] ) - colors[i][j] = strdup(defaultcolors[i][j]); - } - } if (!drw_font_create(drw, font)) die("no fonts could be loaded."); @@ -1987,10 +1985,6 @@ setup(void) scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 3); - for (j = 0; j <= SchemeTabInactive; ++j) { - free(colors[j][ColFg]); - free(colors[j][ColBg]); - } /* init bars */ updatebars(); updatestatus(); @@ -2137,12 +2131,15 @@ tile(Monitor *m) 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); - my += HEIGHT(c); + if (n == 1) + resize(c, m->wx - c->bw, m->wy - c->bw, m->ww, m->wh, 0); + else + resize(c, m->wx - c->bw, m->wy + my - c->bw, mw - c->bw, h, 0); + my += HEIGHT(c) - c->bw; } 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); + resize(c, m->wx + mw - c->bw, m->wy + ty - c->bw, m->ww - mw, h, 0); + ty += HEIGHT(c) - c->bw; } } @@ -2765,7 +2762,7 @@ main(int argc, char *argv[]) static void bstack(Monitor *m) { - int w, h, mh, mx, tx, ty, tw; + int mh, mx, tx, ty, tw; unsigned int i, n; Client *c; @@ -2783,44 +2780,14 @@ bstack(Monitor *m) { } for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { if (i < m->nmaster) { - w = (m->ww - mx) / (MIN(n, m->nmaster) - i); - resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); - mx += WIDTH(c); + resize(c, m->wx + mx - c->bw, m->wy - c->bw, + (m->ww - mx) / (MIN(n, m->nmaster) - i), + n == 1 ? mh : mh - c->bw, 0); + mx += WIDTH(c) - c->bw; } else { - h = m->wh - mh; - resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0); + resize(c, tx - c->bw, ty - c->bw, (m->ww - tx) / (n - i), m->wh - mh, 0); if (tw != m->ww) - tx += WIDTH(c); - } - } -} - -static void -bstackhoriz(Monitor *m) { - int w, mh, mx, tx, ty, th; - unsigned int i, n; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (n == 0) - return; - if (n > m->nmaster) { - mh = m->nmaster ? m->mfact * m->wh : 0; - th = (m->wh - mh) / (n - m->nmaster); - ty = m->wy + mh; - } else { - th = mh = m->wh; - ty = m->wy; - } - for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { - if (i < m->nmaster) { - w = (m->ww - mx) / (MIN(n, m->nmaster) - i); - resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); - mx += WIDTH(c); - } else { - resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0); - if (th != m->wh) - ty += HEIGHT(c); + tx += WIDTH(c) - c->bw; } } }