diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9aedaac..25c03bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,8 +33,8 @@ jobs: strategy: matrix: host: - - Marisa - # - Satori + #- Marisa + #- Satori steps: - uses: actions/checkout@v2.3.4 - uses: cachix/install-nix-action@v13 @@ -53,8 +53,9 @@ jobs: strategy: matrix: home: + #- natto + homeaarch: - ottan - # - natto steps: - uses: actions/checkout@v2.3.4 - uses: cachix/install-nix-action@v13 @@ -66,5 +67,12 @@ jobs: with: name: natto1784 authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix build -L .#hm-configs.${{ matrix.home }}.activationPackage + - uses: uraimo/run-on-arch-action@v2.0.5 + name: Run commands + id: runcmd + with: + arch: aarch64 + distro: ubuntu-latest + run: nix build -L .#hm-configs.${{ matrix.homeaarch }}.activationPackage + - run: nix build -L .#hm-configs.${{ matrix.home }}.activationPackage diff --git a/home/natto.nix b/home/natto.nix index 511f6c0..f897752 100644 --- a/home/natto.nix +++ b/home/natto.nix @@ -19,15 +19,21 @@ in age = { sshKeyPaths = [ "${home}/.ssh/id_ed25519" ]; secrets = { - fish_variables = { + /* fish_variables = { file = ./secrets/fish_variables.age; path = "${home}/.config/fish/fish_variables"; mode = "660"; - }; + }; +*/ mpdasrc = { file = ./secrets/mpdasrc.age; path = "${home}/.config/mpdasrc"; }; + zshrc = { + file = ./secrets/.zshrc.age; + path = "${home}/.zshrc"; + mode = "660"; + }; }; }; home = { diff --git a/home/secrets/.zshrc.age b/home/secrets/.zshrc.age new file mode 100644 index 0000000..9486543 --- /dev/null +++ b/home/secrets/.zshrc.age @@ -0,0 +1,12 @@ +age-encryption.org/v1 +-> ssh-ed25519 kIk5ZQ d7rjGwJPo5zOXvqh2gYgTE08d6NaXXPNNiYlJLAotns +ZmolHuoLbsi/Oql88ZCBk4QgSKwPltDJoBD8cigfBkQ +-> Tf/-grease Ca3wR, S?z +VDYunDSnXz6uPifwdoPfACLpk3a6oVgmcbPH5MeHQ3RgYZHqd0DBRMPCuvZY7YW7 +1L3FuDfLWlUJKMiqSuRnK2R7x6RIg3oumWKjyl1d9jtZWQ3JSmQRqsr2qi7FGA +--- N47PibVyn76ZSrO8etxah5ZiSZcjc+Fi2a1IFlbVZtY +text; item++) ++ len = MAX(TEXTW(item->text), len); ++ return len; ++} ++ + static void + cleanup(void) + { +@@ -113,6 +121,43 @@ + return NULL; + } + ++static void ++drawhighlights(struct item *item, int x, int y, int maxw) ++{ ++ char restorechar, tokens[sizeof text], *highlight, *token; ++ int indentx, highlightlen; ++ ++ drw_setscheme(drw, scheme[item == sel ? SchemeSelHighlight : item->out ? SchemeOutHighlight : SchemeNormHighlight]); ++ strcpy(tokens, text); ++ for (token = strtok(tokens, " "); token; token = strtok(NULL, " ")) { ++ highlight = fstrstr(item->text, token); ++ while (highlight) { ++ // Move item str end, calc width for highlight indent, & restore ++ highlightlen = highlight - item->text; ++ restorechar = *highlight; ++ item->text[highlightlen] = '\0'; ++ indentx = TEXTW(item->text); ++ item->text[highlightlen] = restorechar; ++ ++ // Move highlight str end, draw highlight, & restore ++ restorechar = highlight[strlen(token)]; ++ highlight[strlen(token)] = '\0'; ++ if (indentx - (lrpad / 2) - 1 < maxw) ++ drw_text( ++ drw, ++ x + indentx - (lrpad / 2) - 1, ++ y, ++ MIN(maxw - indentx, TEXTW(highlight) - lrpad), ++ bh, 0, highlight, 0 ++ ); ++ highlight[strlen(token)] = restorechar; ++ ++ if (strlen(highlight) - strlen(token) < strlen(token)) break; ++ highlight = fstrstr(highlight + strlen(token), token); ++ } ++ } ++} ++ + static int + drawitem(struct item *item, int x, int y, int w) + { +@@ -123,7 +168,9 @@ + else + drw_setscheme(drw, scheme[SchemeNorm]); + +- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); ++ int r = drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); ++ drawhighlights(item, x, y, w); ++ return r; + } + + static void +@@ -501,6 +548,119 @@ + } + + static void ++buttonpress(XEvent *e) ++{ ++ struct item *item; ++ XButtonPressedEvent *ev = &e->xbutton; ++ int x = 0, y = 0, h = bh, w; ++ ++ if (ev->window != win) ++ return; ++ ++ /* right-click: exit */ ++ if (ev->button == Button3) ++ exit(1); ++ ++ if (prompt && *prompt) ++ x += promptw; ++ ++ /* input field */ ++ w = (lines > 0 || !matches) ? mw - x : inputw; ++ ++ /* left-click on input: clear input, ++ * NOTE: if there is no left-arrow the space for < is reserved so ++ * add that to the input width */ ++ if (ev->button == Button1 && ++ ((lines <= 0 && ev->x >= 0 && ev->x <= x + w + ++ ((!prev || !curr->left) ? TEXTW("<") : 0)) || ++ (lines > 0 && ev->y >= y && ev->y <= y + h))) { ++ insert(NULL, -cursor); ++ drawmenu(); ++ return; ++ } ++ /* middle-mouse click: paste selection */ ++ if (ev->button == Button2) { ++ XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, ++ utf8, utf8, win, CurrentTime); ++ drawmenu(); ++ return; ++ } ++ /* scroll up */ ++ if (ev->button == Button4 && prev) { ++ sel = curr = prev; ++ calcoffsets(); ++ drawmenu(); ++ return; ++ } ++ /* scroll down */ ++ if (ev->button == Button5 && next) { ++ sel = curr = next; ++ calcoffsets(); ++ drawmenu(); ++ return; ++ } ++ if (ev->button != Button1) ++ return; ++ if (ev->state & ~ControlMask) ++ return; ++ if (lines > 0) { ++ /* vertical list: (ctrl)left-click on item */ ++ w = mw - x; ++ for (item = curr; item != next; item = item->right) { ++ y += h; ++ if (ev->y >= y && ev->y <= (y + h)) { ++ puts(item->text); ++ if (!(ev->state & ControlMask)) ++ exit(0); ++ sel = item; ++ if (sel) { ++ sel->out = 1; ++ drawmenu(); ++ } ++ return; ++ } ++ } ++ } else if (matches) { ++ /* left-click on left arrow */ ++ x += inputw; ++ w = TEXTW("<"); ++ if (prev && curr->left) { ++ if (ev->x >= x && ev->x <= x + w) { ++ sel = curr = prev; ++ calcoffsets(); ++ drawmenu(); ++ return; ++ } ++ } ++ /* horizontal list: (ctrl)left-click on item */ ++ for (item = curr; item != next; item = item->right) { ++ x += w; ++ w = MIN(TEXTW(item->text), mw - x - TEXTW(">")); ++ if (ev->x >= x && ev->x <= x + w) { ++ puts(item->text); ++ if (!(ev->state & ControlMask)) ++ exit(0); ++ sel = item; ++ if (sel) { ++ sel->out = 1; ++ drawmenu(); ++ } ++ return; ++ } ++ } ++ /* left-click on right arrow */ ++ w = TEXTW(">"); ++ x = mw - w; ++ if (next && ev->x >= x && ev->x <= x + w) { ++ sel = curr = next; ++ calcoffsets(); ++ drawmenu(); ++ return; ++ } ++ } ++} ++ ++static void + paste(void) + { + char *p, *q; +@@ -561,6 +721,9 @@ + break; + cleanup(); + exit(1); ++ case ButtonPress: ++ buttonpress(&ev); ++ break; + case Expose: + if (ev.xexpose.count == 0) + drw_map(drw, win, 0, 0, mw, mh); +@@ -611,6 +774,7 @@ + bh = drw->fonts->h + 2; + lines = MAX(lines, 0); + mh = (lines + 1) * bh; ++ promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; + #ifdef XINERAMA + i = 0; + if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) { +@@ -637,9 +801,16 @@ + if (INTERSECT(x, y, 1, 1, info[i])) + break; + +- x = info[i].x_org; +- y = info[i].y_org + (topbar ? 0 : info[i].height - mh); +- mw = info[i].width; ++ if (centered) { ++ mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width); ++ x = info[i].x_org + ((info[i].width - mw) / 2); ++ y = info[i].y_org + ((info[i].height - mh) / 2); ++ } else { ++ x = info[i].x_org; ++ y = info[i].y_org + (topbar ? 0 : info[i].height - mh); ++ mw = info[i].width; ++ } ++ + XFree(info); + } else + #endif +@@ -647,21 +818,30 @@ + if (!XGetWindowAttributes(dpy, parentwin, &wa)) + die("could not get embedding window attributes: 0x%lx", + parentwin); +- x = 0; +- y = topbar ? 0 : wa.height - mh; +- mw = wa.width; ++ ++ if (centered) { ++ mw = MIN(MAX(max_textw() + promptw, min_width), wa.width); ++ x = (wa.width - mw) / 2; ++ y = (wa.height - mh) / 2; ++ } else { ++ x = 0; ++ y = topbar ? 0 : wa.height - mh; ++ mw = wa.width; ++ } + } +- promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; + inputw = MIN(inputw, mw/3); + match(); + + /* create menu window */ + swa.override_redirect = True; + swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; ++ swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | ++ ButtonPressMask; + swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; +- win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, ++ win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, + CopyFromParent, CopyFromParent, CopyFromParent, + CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); ++ XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); + XSetClassHint(dpy, win, &ch); + + +@@ -709,6 +889,8 @@ + topbar = 0; + else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ + fast = 1; ++ else if (!strcmp(argv[i], "-c")) /* centers dmenu on screen */ ++ centered = 1; + else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ + fstrncmp = strncasecmp; + fstrstr = cistrstr; +Only in b: dmenu.c.orig +Only in a: dmenu_path +Only in a: dmenu_run diff --git a/overlays/suckless/dwm.patch b/overlays/suckless/dwm.patch new file mode 100755 index 0000000..b0750fa --- /dev/null +++ b/overlays/suckless/dwm.patch @@ -0,0 +1,602 @@ +diff --color -u a/config.def.h b/config.def.h +--- a/config.def.h 2019-02-02 18:25:28.000000000 +0530 ++++ b/config.def.h 2021-05-21 00:15:46.365943100 +0530 +@@ -1,50 +1,55 @@ + /* See LICENSE file for copyright and license details. */ + + /* appearance */ +-static const unsigned int borderpx = 1; /* border pixel of windows */ ++static const unsigned int borderpx = 4; /* border pixel of windows */ ++static const unsigned int gappx = 6; /* gaps between 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 *colors[][3] = { +- /* fg bg border */ +- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, +- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++static const char *fonts[] = {"Consolas:pixelsize=15", ++ "Font Awesome 5 Free Solid:pixelsize=15", ++ "Font Awesome 5 Brands:pixelsize=15"}; ++static const char col_1[] = "#1d2021"; ++static const char col_2[] = "#444444"; ++static const char col_3[] = "#bbbbbb"; ++static const char col_4[] = "#1d2021"; ++static const char col_5[] = "#ebdbb2"; ++static const char *colors[][3] = { ++ /* fg bg border */ ++ [SchemeNorm] = {col_3, col_1, col_2}, ++ [SchemeSel] = {col_4, col_5, col_5}, + }; +- + /* tagging */ +-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + +-static const Rule rules[] = { ++static const char *tags[] = {"", "", "", "", "", "", "", "", ""}; ++ ++static const Rule rules[0];// = { + /* 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 }, +-}; ++// { "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 nmaster = 0; /* number of clients in master area */ ++static const int resizehints = 0; /* 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|", centeredmaster }, ++ { "><>", NULL }, + { "[M]", monocle }, ++ { "[]=", tile }, ++ { ">M>", centeredfloatingmaster }, + }; + + /* key definitions */ +-#define MODKEY Mod1Mask ++#define MODKEY Mod4Mask ++#define Print 0x0000ff61 + #define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ +@@ -55,45 +60,66 @@ + #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 char dmenumon[2] = "0"; ++static const char *dmenucmd[] = { "dmenu_run","-l","20", NULL}; ++static const char *termcmd[] = { "st",NULL }; ++static const char *ss1[] ={"flameshot", "full" ,"-p","/home/natto/Pictures",NULL}; ++static const char *ss2[] ={"flameshot", "gui" ,"-p","/home/natto/Pictures",NULL}; ++static const char *ss3[] ={"flameshot", "full" ,"-p","/home/natto/Pictures","-d","10000",NULL}; ++static const char *mpc1[] = {"mpc", "next",NULL}; ++static const char *mpc2[] = {"mpc", "prev",NULL}; ++static const char *mpc3[] = {"mpc", "toggle",NULL}; ++static const char *mpc4[] = {"mpc", "seek","+00:00:05",NULL}; ++static const char *mpc5[] = {"mpc", "seek","-00:00:05",NULL}; ++static const char *volinc[] = {"pamixer", "-i","5",NULL}; ++static const char *voldec[] = {"pamixer", "-d", "5",NULL}; + static Key keys[] = { + /* modifier key function argument */ +- { MODKEY, XK_p, spawn, {.v = dmenucmd } }, +- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, ++ { MODKEY, XK_d, 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_o, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, +- { MODKEY, XK_Return, zoom, {0} }, ++ { 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|ShiftMask, XK_q, killclient, {0} }, ++ { MODKEY, XK_t, setlayout, {.v = &layouts[3]} }, ++ { MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, ++ { MODKEY, XK_u, setlayout, {.v = &layouts[0]} }, ++ { MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[4]} }, ++ { MODKEY, XK_f, togglefullscr, {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 } }, ++ {0, Print, spawn, {.v = ss1} }, ++ {ShiftMask, Print, spawn, {.v = ss2} }, ++ {Mod1Mask, Print, spawn, {.v = ss3} }, ++ {MODKEY, XK_p, spawn, {.v = mpc3} }, ++ {MODKEY|ShiftMask, XK_h, spawn, {.v = mpc1} }, ++ {MODKEY|ShiftMask, XK_k, spawn, {.v = mpc2} }, ++ {MODKEY|ShiftMask, XK_r, spawn, {.v = mpc4} }, ++ {MODKEY|ShiftMask, XK_a, spawn, {.v = mpc5} }, ++ {MODKEY|ShiftMask, XK_period, spawn, {.v = volinc} }, ++ {MODKEY|ShiftMask, XK_comma, spawn, {.v = voldec} }, ++ //{ 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_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} }, ++ { MODKEY|ShiftMask, XK_e, quit, {0} }, + }; + + /* button definitions */ +Only in b: config.def.h.orig +diff --color -u a/config.mk b/config.mk +--- a/config.mk 2019-02-02 18:25:28.000000000 +0530 ++++ b/config.mk 2021-05-21 00:15:46.366562100 +0530 +@@ -25,7 +25,7 @@ + LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} + + # flags +-CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ++CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} + #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} + CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} + LDFLAGS = ${LIBS} +diff --color -u a/drw.c b/drw.c +--- a/drw.c 2019-02-02 18:25:28.000000000 +0530 ++++ b/drw.c 2021-05-21 00:15:46.366998100 +0530 +@@ -95,6 +95,7 @@ + { + XFreePixmap(drw->dpy, drw->drawable); + XFreeGC(drw->dpy, drw->gc); ++ drw_fontset_free(drw->fonts); + free(drw); + } + +diff --color -u a/dwm.1 b/dwm.1 +--- a/dwm.1 2019-02-02 18:25:28.000000000 +0530 ++++ b/dwm.1 2021-05-21 00:15:46.367636200 +0530 +@@ -33,7 +33,7 @@ + .SH OPTIONS + .TP + .B \-v +-prints version information to standard output, then exits. ++prints version information to stderr, then exits. + .SH USAGE + .SS Status bar + .TP +diff --color -u a/dwm.c b/dwm.c +--- a/dwm.c 2019-02-02 18:25:28.000000000 +0530 ++++ b/dwm.c 2021-05-21 00:15:46.368968400 +0530 +@@ -52,8 +52,8 @@ + #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) + #define LENGTH(X) (sizeof X / sizeof X[0]) + #define MOUSEMASK (BUTTONMASK|PointerMotionMask) +-#define WIDTH(X) ((X)->w + 2 * (X)->bw) +-#define HEIGHT(X) ((X)->h + 2 * (X)->bw) ++#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx) ++#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx) + #define TAGMASK ((1 << LENGTH(tags)) - 1) + #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) + +@@ -169,6 +169,7 @@ + static void focusin(XEvent *e); + static void focusmon(const Arg *arg); + static void focusstack(const Arg *arg); ++static Atom getatomprop(Client *c, Atom prop); + static int getrootptr(int *x, int *y); + static long getstate(Window w); + static int gettextprop(Window w, Atom atom, char *text, unsigned int size); +@@ -193,6 +194,7 @@ + static void resizemouse(const Arg *arg); + static void restack(Monitor *m); + static void run(void); ++static void runAutostart(void); + static void scan(void); + static int sendevent(Client *c, Atom proto); + static void sendmon(Client *c, Monitor *m); +@@ -211,6 +213,7 @@ + static void tile(Monitor *); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); ++static void togglefullscr(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); +@@ -233,6 +236,8 @@ + static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); ++static void centeredmaster(Monitor *m); ++static void centeredfloatingmaster(Monitor *m); + + /* variables */ + static const char broken[] = "broken"; +@@ -416,7 +421,7 @@ + void + buttonpress(XEvent *e) + { +- unsigned int i, x, click; ++ unsigned int i, x, click, occ = 0; + Arg arg = {0}; + Client *c; + Monitor *m; +@@ -431,15 +436,20 @@ + } + if (ev->window == selmon->barwin) { + i = x = 0; +- do ++ for (c = m->clients; c; c = c->next) ++ occ |= c->tags == 255 ? 0 : c->tags; ++ do { ++ /* do not reserve space for vacant tags */ ++ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) ++ continue; + x += TEXTW(tags[i]); +- while (ev->x >= x && ++i < LENGTH(tags)); ++ } while (ev->x >= x && ++i < LENGTH(tags)); + if (i < LENGTH(tags)) { + click = ClkTagBar; + arg.ui = 1 << i; + } else if (ev->x < x + blw) + click = ClkLtSymbol; +- else if (ev->x > selmon->ww - TEXTW(stext)) ++ else if (ev->x > selmon->ww - (int)TEXTW(stext)) + click = ClkStatusText; + else + click = ClkWinTitle; +@@ -695,7 +705,7 @@ + void + drawbar(Monitor *m) + { +- int x, w, sw = 0; ++ int x, w, tw = 0; + int boxs = drw->fonts->h / 9; + int boxw = drw->fonts->h / 6 + 2; + unsigned int i, occ = 0, urg = 0; +@@ -704,31 +714,31 @@ + /* 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]); +- sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ +- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); ++ tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ ++ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); + } + + for (c = m->clients; c; c = c->next) { +- occ |= c->tags; ++ occ |= c->tags == 255 ? 0 : c->tags; + if (c->isurgent) + urg |= c->tags; + } + x = 0; + for (i = 0; i < LENGTH(tags); i++) { ++ /* do not draw vacant tags */ ++ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) ++ continue; ++ + w = TEXTW(tags[i]); + drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); + 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, +- m == selmon && selmon->sel && selmon->sel->tags & 1 << i, +- urg & 1 << i); + x += w; + } + w = blw = TEXTW(m->ltsymbol); + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + +- if ((w = m->ww - sw - x) > bh) { ++ if ((w = m->ww - tw - x) > bh) { + if (m->sel) { + drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); +@@ -1276,12 +1286,46 @@ + resizeclient(Client *c, int x, int y, int w, int h) + { + XWindowChanges wc; ++ unsigned int n; ++ unsigned int gapoffset; ++ unsigned int gapincr; ++ Client *nbc; ++ ++ wc.border_width = c->bw; ++ ++ /* Get number of clients for the client's monitor */ ++ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++); + +- c->oldx = c->x; c->x = wc.x = x; +- c->oldy = c->y; c->y = wc.y = y; ++ /* Do nothing if layout is floating */ ++ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { ++ gapincr = gapoffset = 0; ++ } else { ++ /* Remove border and gap if layout is monocle or only one client */ ++ if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) { ++ gapoffset = 0; ++ gapincr = -2 * borderpx; ++ wc.border_width = 0; ++ } else { ++ gapoffset = gappx; ++ gapincr = 2 * gappx; ++ } ++ } ++ ++ c->oldx = c->x; c->x = wc.x = x + gapoffset; ++ c->oldy = c->y; c->y = wc.y = y + gapoffset; ++ c->oldw = c->w; c->w = wc.width = w - gapincr; ++ c->oldh = c->h; c->h = wc.height = h - gapincr; + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) ++ || &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); +@@ -1381,6 +1425,12 @@ + } + + void ++runAutostart(void) { ++ system("cd ~/.dwm; ./autostart_blocking.sh"); ++ system("cd ~/.dwm; ./autostart.sh &"); ++} ++ ++void + scan(void) + { + unsigned int i, num; +@@ -1520,7 +1570,7 @@ + if (!arg || !selmon->lt[selmon->sellt]->arrange) + return; + f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; +- if (f < 0.1 || f > 0.9) ++ if (f < 0.05 || f > 0.95) + return; + selmon->mfact = f; + arrange(selmon); +@@ -1688,11 +1738,13 @@ + 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 (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); +- ty += HEIGHT(c); ++ if (ty + HEIGHT(c) < m->wh) ++ ty += HEIGHT(c); + } + } + +@@ -1720,6 +1772,13 @@ + } + + void ++togglefullscr(const Arg *arg) ++{ ++ if(selmon->sel) ++ setfullscreen(selmon->sel, !selmon->sel->isfullscreen); ++} ++ ++void + toggletag(const Arg *arg) + { + unsigned int newtags; +@@ -2142,8 +2201,112 @@ + die("pledge"); + #endif /* __OpenBSD__ */ + scan(); ++ runAutostart(); + run(); + cleanup(); + XCloseDisplay(dpy); + return EXIT_SUCCESS; + } ++ ++void ++centeredmaster(Monitor *m) ++{ ++ unsigned int i, n, h, mw, mx, my, oty, ety, tw; ++ Client *c; ++ ++ /* count number of clients in the selected monitor */ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ ++ /* initialize areas */ ++ mw = m->ww; ++ mx = 0; ++ my = 0; ++ tw = mw; ++ ++ if (n > m->nmaster) { ++ /* go mfact box in the center if more than nmaster clients */ ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ tw = m->ww - mw; ++ ++ if (n - m->nmaster > 1) { ++ /* only one client */ ++ mx = (m->ww - mw) / 2; ++ tw = (m->ww - mw) / 2; ++ } ++ } ++ ++ oty = 0; ++ ety = 0; ++ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { ++ /* nmaster clients are stacked vertically, in the center ++ * of the screen */ ++ h = (m->wh - my) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw), ++ h - (2*c->bw), 0); ++ my += HEIGHT(c); ++ } else { ++ /* stack clients are stacked vertically */ ++ if ((i - m->nmaster) % 2 ) { ++ h = (m->wh - ety) / ( (1 + n - i) / 2); ++ resize(c, m->wx, m->wy + ety, tw - (2*c->bw), ++ h - (2*c->bw), 0); ++ ety += HEIGHT(c); ++ } else { ++ h = (m->wh - oty) / ((1 + n - i) / 2); ++ resize(c, m->wx + mx + mw, m->wy + oty, ++ tw - (2*c->bw), h - (2*c->bw), 0); ++ oty += HEIGHT(c); ++ } ++ } ++} ++ ++void ++centeredfloatingmaster(Monitor *m) ++{ ++ unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx; ++ Client *c; ++ ++ /* count number of clients in the selected monitor */ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ ++ /* initialize nmaster area */ ++ if (n > m->nmaster) { ++ /* go mfact box in the center if more than nmaster clients */ ++ if (m->ww > m->wh) { ++ mw = m->nmaster ? m->ww * m->mfact : 0; ++ mh = m->nmaster ? m->wh * 0.9 : 0; ++ } else { ++ mh = m->nmaster ? m->wh * m->mfact : 0; ++ mw = m->nmaster ? m->ww * 0.9 : 0; ++ } ++ mx = mxo = (m->ww - mw) / 2; ++ my = myo = (m->wh - mh) / 2; ++ } else { ++ /* go fullscreen if all clients are in the master area */ ++ mh = m->wh; ++ mw = m->ww; ++ mx = mxo = 0; ++ my = myo = 0; ++ } ++ ++ for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) ++ if (i < m->nmaster) { ++ /* nmaster clients are stacked horizontally, in the center ++ * of the screen */ ++ w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy + my, w - (2*c->bw), ++ mh - (2*c->bw), 0); ++ mx += WIDTH(c); ++ } else { ++ /* stack clients are stacked horizontally */ ++ w = (m->ww - tx) / (n - i); ++ resize(c, m->wx + tx, m->wy, w - (2*c->bw), ++ m->wh - (2*c->bw), 0); ++ tx += WIDTH(c); ++ } ++} +Only in b: dwm.c.orig +Only in b: .git +Only in a: LICENSE +diff --color -u a/README b/README +--- a/README 2019-02-02 18:25:28.000000000 +0530 ++++ b/README 2021-05-21 00:15:46.365490600 +0530 +@@ -1,48 +1 @@ +-dwm - dynamic window manager +-============================ +-dwm is an extremely fast, small, and dynamic window manager for X. +- +- +-Requirements +------------- +-In order to build dwm you need the Xlib header files. +- +- +-Installation +------------- +-Edit config.mk to match your local setup (dwm is installed into +-the /usr/local namespace by default). +- +-Afterwards enter the following command to build and install dwm (if +-necessary as root): +- +- make clean install +- +- +-Running dwm +------------ +-Add the following line to your .xinitrc to start dwm using startx: +- +- exec dwm +- +-In order to connect dwm to a specific display, make sure that +-the DISPLAY environment variable is set correctly, e.g.: +- +- DISPLAY=foo.bar:1 exec dwm +- +-(This will start dwm on display :1 of the host foo.bar.) +- +-In order to display status info in the bar, you can do something +-like this in your .xinitrc: +- +- while xsetroot -name "`date` `uptime | sed 's/.*,//'`" +- do +- sleep 1 +- done & +- exec dwm +- +- +-Configuration +-------------- +-The configuration of dwm is done by creating a custom config.h +-and (re)compiling the source code. ++Forked from dwm https://git.suckless.org/dwm and applied official patches diff --git a/overlays/st.patch b/overlays/suckless/st.patch similarity index 87% rename from overlays/st.patch rename to overlays/suckless/st.patch index e23078d..a57f8a0 100755 --- a/overlays/st.patch +++ b/overlays/suckless/st.patch @@ -1,7 +1,7 @@ -diff '--color=auto' -u a/config.def.h b/config.def.h ---- a/config.def.h 2021-05-18 08:15:14.270294000 +0530 -+++ b/config.def.h 2021-05-18 07:53:37.126991600 +0530 -@@ -3,9 +3,8 @@ +diff --color -u a/config.def.h b/config.def.h +--- a/config.def.h 2020-06-19 14:59:45.000000000 +0530 ++++ b/config.def.h 2021-05-21 05:21:13.476454500 +0530 +@@ -3,9 +3,10 @@ /* * appearance * @@ -9,10 +9,12 @@ diff '--color=auto' -u a/config.def.h b/config.def.h */ -static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; +static char *font = "Fira Mono:style=Regular:pixelsize=16"; ++static char *font2[] = { "Font Awesome 5 Free Solid:pixelsize=15", ++ "Font Awesome 5 Brands:pixelsize=15" }; static int borderpx = 2; /* -@@ -16,7 +15,7 @@ +@@ -16,7 +17,7 @@ * 4: value of shell in /etc/passwd * 5: value of shell in config.h */ @@ -21,7 +23,7 @@ diff '--color=auto' -u a/config.def.h b/config.def.h char *utmp = NULL; /* scroll program: to enable use a string like "scroll" */ char *scroll = NULL; -@@ -95,42 +94,37 @@ +@@ -95,42 +96,37 @@ /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { @@ -90,7 +92,7 @@ diff '--color=auto' -u a/config.def.h b/config.def.h /* * Default shape of cursor -@@ -154,7 +148,6 @@ +@@ -154,7 +150,6 @@ static unsigned int mouseshape = XC_xterm; static unsigned int mousefg = 7; static unsigned int mousebg = 0; @@ -98,7 +100,7 @@ diff '--color=auto' -u a/config.def.h b/config.def.h /* * Color used to display font attributes when fontconfig selected a font which * doesn't match the ones requested. -@@ -173,32 +166,36 @@ +@@ -173,32 +168,36 @@ * Beware that overloading Button1 will disable the selection. */ static MouseShortcut mshortcuts[] = { @@ -155,7 +157,7 @@ diff '--color=auto' -u a/config.def.h b/config.def.h }; /* -@@ -226,229 +223,229 @@ +@@ -226,229 +225,229 @@ * If you want keys other than the X11 function keys (0xFD00 - 0xFFFF) * to be mapped below, add them to this array. */ @@ -597,7 +599,7 @@ diff '--color=auto' -u a/config.def.h b/config.def.h }; /* -@@ -459,14 +456,13 @@ +@@ -459,14 +458,13 @@ * If no match is found, regular selection is used. */ static uint selmasks[] = { @@ -616,9 +618,11 @@ diff '--color=auto' -u a/config.def.h b/config.def.h +static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?" + "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" + "`abcdefghijklmnopqrstuvwxyz{|}~"; -diff '--color=auto' -u a/st.c b/st.c ---- a/st.c 2021-05-18 08:15:14.274578800 +0530 -+++ b/st.c 2021-03-19 01:52:39.516045300 +0530 +Only in b: config.def.h.orig +Only in b: config.def.h.rej +diff --color -u a/st.c b/st.c +--- a/st.c 2020-06-19 14:59:45.000000000 +0530 ++++ b/st.c 2021-05-21 05:07:22.806708800 +0530 @@ -35,6 +35,7 @@ #define ESC_ARG_SIZ 16 #define STR_BUF_SIZ ESC_BUF_SIZ @@ -647,67 +651,18 @@ diff '--color=auto' -u a/st.c b/st.c int *dirty; /* dirtyness of lines */ TCursor c; /* cursor */ int ocx; /* old cursor col */ -@@ -184,20 +191,20 @@ +@@ -184,8 +191,8 @@ static void tputtab(int); static void tputc(Rune); static void treset(void); -static void tscrollup(int, int); -static void tscrolldown(int, int); --static void tsetattr(const int *, int); --static void tsetchar(Rune, const Glyph *, int, int); +static void tscrollup(int, int, int); +static void tscrolldown(int, int, int); -+static void tsetattr(int *, int); -+static void tsetchar(Rune, Glyph *, int, int); + static void tsetattr(int *, int); + static void tsetchar(Rune, Glyph *, int, int); static void tsetdirt(int, int); - static void tsetscroll(int, int); - static void tswapscreen(void); --static void tsetmode(int, int, const int *, int); -+static void tsetmode(int, int, int *, int); - static int twrite(const char *, int, int); - static void tfulldirt(void); - static void tcontrolcode(uchar ); - static void tdectest(char ); - static void tdefutf8(char); --static int32_t tdefcolor(const int *, int *, int); -+static int32_t tdefcolor(int *, int *, int); - static void tdeftran(char); - static void tstrsequence(uchar); - -@@ -226,10 +233,10 @@ - static int cmdfd; - static pid_t pid; - --static const uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; --static const uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; --static const Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; --static const Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; -+static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; -+static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; -+static Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; -+static Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; - - ssize_t - xwrite(int fd, const char *s, size_t len) -@@ -269,14 +276,12 @@ - } - - char * --xstrdup(const char *s) -+xstrdup(char *s) - { -- char *p; -- -- if ((p = strdup(s)) == NULL) -+ if ((s = strdup(s)) == NULL) - die("strdup: %s\n", strerror(errno)); - -- return p; -+ return s; - } - - size_t -@@ -416,10 +421,10 @@ +@@ -414,10 +421,10 @@ { int i = term.col; @@ -720,16 +675,7 @@ diff '--color=auto' -u a/st.c b/st.c --i; return i; -@@ -520,7 +525,7 @@ - { - int newx, newy, xt, yt; - int delim, prevdelim; -- const Glyph *gp, *prevgp; -+ Glyph *gp, *prevgp; - - switch (sel.snap) { - case SNAP_WORD: -@@ -528,7 +533,7 @@ +@@ -526,7 +533,7 @@ * Snap around if the word wraps around at the end or * beginning of a line. */ @@ -738,7 +684,7 @@ diff '--color=auto' -u a/st.c b/st.c prevdelim = ISDELIM(prevgp->u); for (;;) { newx = *x + direction; -@@ -543,14 +548,14 @@ +@@ -541,14 +548,14 @@ yt = *y, xt = *x; else yt = newy, xt = newx; @@ -755,7 +701,7 @@ diff '--color=auto' -u a/st.c b/st.c delim = ISDELIM(gp->u); if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim || (delim && gp->u != prevgp->u))) -@@ -571,14 +576,14 @@ +@@ -569,14 +576,14 @@ *x = (direction < 0) ? 0 : term.col - 1; if (direction < 0) { for (; *y > 0; *y += direction) { @@ -772,16 +718,7 @@ diff '--color=auto' -u a/st.c b/st.c & ATTR_WRAP)) { break; } -@@ -593,7 +598,7 @@ - { - char *str, *ptr; - int y, bufsize, lastx, linelen; -- const Glyph *gp, *last; -+ Glyph *gp, *last; - - if (sel.ob.x == -1) - return NULL; -@@ -609,13 +614,13 @@ +@@ -607,13 +614,13 @@ } if (sel.type == SEL_RECTANGULAR) { @@ -798,16 +735,7 @@ diff '--color=auto' -u a/st.c b/st.c while (last >= gp && last->u == ' ') --last; -@@ -760,7 +765,7 @@ - } - - int --ttynew(const char *line, char *cmd, const char *out, char **args) -+ttynew(char *line, char *cmd, char *out, char **args) - { - int m, s; - -@@ -850,6 +855,9 @@ +@@ -848,6 +855,9 @@ ttywrite(const char *s, size_t n, int may_echo) { const char *next; @@ -817,7 +745,7 @@ diff '--color=auto' -u a/st.c b/st.c if (may_echo && IS_SET(MODE_ECHO)) twrite(s, n, 1); -@@ -1061,13 +1069,53 @@ +@@ -1059,13 +1069,53 @@ } void @@ -872,7 +800,7 @@ diff '--color=auto' -u a/st.c b/st.c tsetdirt(orig, term.bot-n); tclearregion(0, term.bot-n+1, term.col-1, term.bot); -@@ -1077,17 +1125,28 @@ +@@ -1075,17 +1125,28 @@ term.line[i-n] = temp; } @@ -903,7 +831,7 @@ diff '--color=auto' -u a/st.c b/st.c tclearregion(0, orig, term.col-1, orig+n-1); tsetdirt(orig+n, term.bot); -@@ -1097,7 +1156,8 @@ +@@ -1095,7 +1156,8 @@ term.line[i+n] = temp; } @@ -913,7 +841,7 @@ diff '--color=auto' -u a/st.c b/st.c } void -@@ -1126,7 +1186,7 @@ +@@ -1124,7 +1186,7 @@ int y = term.c.y; if (y == term.bot) { @@ -922,19 +850,7 @@ diff '--color=auto' -u a/st.c b/st.c } else { y++; } -@@ -1188,9 +1248,9 @@ - } - - void --tsetchar(Rune u, const Glyph *attr, int x, int y) -+tsetchar(Rune u, Glyph *attr, int x, int y) - { -- static const char *vt100_0[62] = { /* 0x41 - 0x7e */ -+ static char *vt100_0[62] = { /* 0x41 - 0x7e */ - "↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */ - 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */ - 0, 0, 0, 0, 0, 0, 0, 0, /* P - W */ -@@ -1291,18 +1351,18 @@ +@@ -1289,14 +1351,14 @@ tinsertblankline(int n) { if (BETWEEN(term.c.y, term.top, term.bot)) @@ -951,33 +867,7 @@ diff '--color=auto' -u a/st.c b/st.c } int32_t --tdefcolor(const int *attr, int *npar, int l) -+tdefcolor(int *attr, int *npar, int l) - { - int32_t idx = -1; - uint r, g, b; -@@ -1352,7 +1412,7 @@ - } - - void --tsetattr(const int *attr, int l) -+tsetattr(int *attr, int l) - { - int i; - int32_t idx; -@@ -1470,9 +1530,9 @@ - } - - void --tsetmode(int priv, int set, const int *args, int narg) -+tsetmode(int priv, int set, int *args, int narg) - { -- int alt; const int *lim; -+ int alt, *lim; - - for (lim = args + narg; args < lim; ++args) { - if (priv) { -@@ -1735,11 +1795,11 @@ +@@ -1733,11 +1795,11 @@ break; case 'S': /* SU -- Scroll line up */ DEFAULT(csiescseq.arg[0], 1); @@ -991,16 +881,23 @@ diff '--color=auto' -u a/st.c b/st.c break; case 'L': /* IL -- Insert blank lines */ DEFAULT(csiescseq.arg[0], 1); -@@ -2022,7 +2082,7 @@ - tdumpline(int n) - { - char buf[UTF_SIZ]; -- const Glyph *bp, *end; -+ Glyph *bp, *end; - - bp = &term.line[n][0]; - end = &bp[MIN(tlinelen(n), term.col) - 1]; -@@ -2251,7 +2311,7 @@ +@@ -1853,7 +1915,15 @@ + case ']': /* OSC -- Operating System Command */ + switch (par) { + case 0: ++ if (narg > 1) { ++ xsettitle(strescseq.args[1]); ++ xseticontitle(strescseq.args[1]); ++ } ++ return; + case 1: ++ if (narg > 1) ++ xseticontitle(strescseq.args[1]); ++ return; + case 2: + if (narg > 1) + xsettitle(strescseq.args[1]); +@@ -2241,7 +2311,7 @@ return 0; case 'D': /* IND -- Linefeed */ if (term.c.y == term.bot) { @@ -1009,7 +906,7 @@ diff '--color=auto' -u a/st.c b/st.c } else { tmoveto(term.c.x, term.c.y+1); } -@@ -2264,7 +2324,7 @@ +@@ -2254,7 +2324,7 @@ break; case 'M': /* RI -- Reverse index */ if (term.c.y == term.top) { @@ -1018,7 +915,7 @@ diff '--color=auto' -u a/st.c b/st.c } else { tmoveto(term.c.x, term.c.y-1); } -@@ -2474,7 +2534,7 @@ +@@ -2464,7 +2534,7 @@ void tresize(int col, int row) { @@ -1027,7 +924,7 @@ diff '--color=auto' -u a/st.c b/st.c int minrow = MIN(row, term.row); int mincol = MIN(col, term.col); int *bp; -@@ -2511,6 +2571,14 @@ +@@ -2501,6 +2571,14 @@ term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); @@ -1042,7 +939,7 @@ diff '--color=auto' -u a/st.c b/st.c /* resize each row to new width, zero-pad if needed */ for (i = 0; i < minrow; i++) { term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); -@@ -2569,7 +2637,7 @@ +@@ -2559,7 +2637,7 @@ continue; term.dirty[y] = 0; @@ -1051,7 +948,7 @@ diff '--color=auto' -u a/st.c b/st.c } } -@@ -2590,8 +2658,9 @@ +@@ -2580,8 +2658,9 @@ cx--; drawregion(0, 0, term.col, term.row); @@ -1063,9 +960,9 @@ diff '--color=auto' -u a/st.c b/st.c term.ocx = cx; term.ocy = term.c.y; xfinishdraw(); -diff '--color=auto' -u a/st.h b/st.h ---- a/st.h 2021-05-18 08:15:14.275523400 +0530 -+++ b/st.h 2021-03-19 01:52:39.517474600 +0530 +diff --color -u a/st.h b/st.h +--- a/st.h 2020-06-19 14:59:45.000000000 +0530 ++++ b/st.h 2021-05-21 05:07:22.806891600 +0530 @@ -81,6 +81,8 @@ void redraw(void); void draw(void); @@ -1075,62 +972,149 @@ diff '--color=auto' -u a/st.h b/st.h void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *); -@@ -91,7 +93,7 @@ - void tresize(int, int); - void tsetdirtattr(int); - void ttyhangup(void); --int ttynew(const char *, char *, const char *, char **); -+int ttynew(char *, char *, char *, char **); - size_t ttyread(void); - void ttyresize(int, int); - void ttywrite(const char *, size_t, int); -@@ -109,7 +111,7 @@ - - void *xmalloc(size_t); - void *xrealloc(void *, size_t); --char *xstrdup(const char *); -+char *xstrdup(char *); - - /* config.h globals */ - extern char *utmp; -diff '--color=auto' -u a/x.c b/x.c ---- a/x.c 2021-05-18 08:15:14.281235100 +0530 -+++ b/x.c 2021-03-19 01:52:25.361188800 +0530 -@@ -156,7 +156,7 @@ - static void xhints(void); +diff --color -u a/win.h b/win.h +--- a/win.h 2020-06-19 14:59:45.000000000 +0530 ++++ b/win.h 2021-05-21 05:07:22.805511800 +0530 +@@ -30,6 +30,7 @@ + void xfinishdraw(void); + void xloadcols(void); + int xsetcolorname(int, const char *); ++void xseticontitle(char *); + void xsettitle(char *); + int xsetcursor(int); + void xsetmode(int, unsigned int); +diff --color -u a/x.c b/x.c +--- a/x.c 2020-06-19 14:59:45.000000000 +0530 ++++ b/x.c 2021-05-21 05:20:09.551000300 +0530 +@@ -93,7 +93,7 @@ + Window win; + Drawable buf; + GlyphFontSpec *specbuf; /* font spec buffer used for rendering */ +- Atom xembed, wmdeletewin, netwmname, netwmpid; ++ Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid; + struct { + XIM xim; + XIC xic; +@@ -157,6 +157,7 @@ static int xloadcolor(int, const char *, Color *); static int xloadfont(Font *, FcPattern *); --static void xloadfonts(const char *, double); -+static void xloadfonts(char *, double); + static void xloadfonts(char *, double); ++static void xloadsparefont(); static void xunloadfont(Font *); static void xunloadfonts(void); static void xsetenv(void); -@@ -387,9 +387,7 @@ - button = 3; - } else { - button -= Button1; -- if (button >= 7) -- button += 128 - 7; -- else if (button >= 3) -+ if (button >= 3) - button += 64 - 3; - } - if (e->xbutton.type == ButtonPress) { -@@ -952,7 +950,7 @@ +@@ -306,6 +307,7 @@ + { + xunloadfonts(); + xloadfonts(usedfont, arg->f); ++ xloadsparefont(); + cresize(0, 0); + redraw(); + xhints(); +@@ -1020,6 +1022,67 @@ } void --xloadfonts(const char *fontstr, double fontsize) -+xloadfonts(char *fontstr, double fontsize) ++xloadsparefont() ++{ ++ FcPattern *fontpattern, *match; ++ FcResult result; ++ ++ /* add font2 to font cache as first 4 entries */ ++ if ( font2[0] == '-' ) ++ fontpattern = XftXlfdParse(font2, False, False); ++ else ++ fontpattern = FcNameParse((FcChar8 *)font2); ++ if ( fontpattern ) { ++ /* Allocate memory for the new cache entries. */ ++ frccap += 4; ++ frc = xrealloc(frc, frccap * sizeof(Fontcache)); ++ /* add Normal */ ++ match = FcFontMatch(NULL, fontpattern, &result); ++ if ( match ) ++ frc[frclen].font = XftFontOpenPattern(xw.dpy, match); ++ if ( frc[frclen].font ) { ++ frc[frclen].flags = FRC_NORMAL; ++ frclen++; ++ } else ++ FcPatternDestroy(match); ++ /* add Italic */ ++ FcPatternDel(fontpattern, FC_SLANT); ++ FcPatternAddInteger(fontpattern, FC_SLANT, FC_SLANT_ITALIC); ++ match = FcFontMatch(NULL, fontpattern, &result); ++ if ( match ) ++ frc[frclen].font = XftFontOpenPattern(xw.dpy, match); ++ if ( frc[frclen].font ) { ++ frc[frclen].flags = FRC_ITALIC; ++ frclen++; ++ } else ++ FcPatternDestroy(match); ++ /* add Italic Bold */ ++ FcPatternDel(fontpattern, FC_WEIGHT); ++ FcPatternAddInteger(fontpattern, FC_WEIGHT, FC_WEIGHT_BOLD); ++ match = FcFontMatch(NULL, fontpattern, &result); ++ if ( match ) ++ frc[frclen].font = XftFontOpenPattern(xw.dpy, match); ++ if ( frc[frclen].font ) { ++ frc[frclen].flags = FRC_ITALICBOLD; ++ frclen++; ++ } else ++ FcPatternDestroy(match); ++ /* add Bold */ ++ FcPatternDel(fontpattern, FC_SLANT); ++ FcPatternAddInteger(fontpattern, FC_SLANT, FC_SLANT_ROMAN); ++ match = FcFontMatch(NULL, fontpattern, &result); ++ if ( match ) ++ frc[frclen].font = XftFontOpenPattern(xw.dpy, match); ++ if ( frc[frclen].font ) { ++ frc[frclen].flags = FRC_BOLD; ++ frclen++; ++ } else ++ FcPatternDestroy(match); ++ FcPatternDestroy(fontpattern); ++ } ++} ++ ++void + xunloadfont(Font *f) { - FcPattern *pattern; - double fontval; -@@ -960,7 +958,7 @@ - if (fontstr[0] == '-') - pattern = XftXlfdParse(fontstr, False, False); - else -- pattern = FcNameParse((const FcChar8 *)fontstr); -+ pattern = FcNameParse((FcChar8 *)fontstr); + XftFontClose(xw.dpy, f->match); +@@ -1116,6 +1179,9 @@ + usedfont = (opt_font == NULL)? font : opt_font; + xloadfonts(usedfont, 0); - if (!pattern) - die("can't open font %s\n", fontstr); ++ /* spare font (font2) */ ++ xloadsparefont(); ++ + /* colors */ + xw.cmap = XDefaultColormap(xw.dpy, xw.scr); + xloadcols(); +@@ -1186,6 +1252,7 @@ + xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); + xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); + xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False); ++ xw.netwmiconname = XInternAtom(xw.dpy, "_NET_WM_ICON_NAME", False); + XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1); + + xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False); +@@ -1580,6 +1647,19 @@ + } + + void ++xseticontitle(char *p) ++{ ++ XTextProperty prop; ++ DEFAULT(p, opt_title); ++ ++ Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle, ++ &prop); ++ XSetWMIconName(xw.dpy, xw.win, &prop); ++ XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmiconname); ++ XFree(prop.value); ++} ++ ++void + xsettitle(char *p) + { + XTextProperty prop; +Only in b: x.c.orig