dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

Commit: eeed60ece9b4f53bbf872b1836d402c4daded9f6
Parent: a5413260c0c5e0498c6150702bb8697d56768501
Author: Randy Palamar
Date:   Tue, 24 Oct 2023 06:20:30 -0600

portage: update st config

Diffstat:
A.config/sys/etc/portage/patches/x11-terms/st/0001-support-second-theme-and-runtime-swapping.patch | 42++++++++++++++++++++++++++++++++++++++++++
A.config/sys/etc/portage/patches/x11-terms/st/0002-support-setting-the-default-font-size-on-invocation.patch | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/sys/etc/portage/patches/x11-terms/st/0003-open-in-cwd.patch | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/sys/etc/portage/patches/x11-terms/st/0004-split-borderpx-into-x-and-y-components.patch | 218+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D.config/sys/etc/portage/patches/x11-terms/st/st-defaultfontsize-20210225-4ef0cbd.diff | 79-------------------------------------------------------------------------------
D.config/sys/etc/portage/patches/x11-terms/st/st-recolor.patch | 30------------------------------
M.config/sys/etc/portage/savedconfig/x11-terms/st-9999 | 8++++++--
7 files changed, 473 insertions(+), 111 deletions(-)

diff --git a/.config/sys/etc/portage/patches/x11-terms/st/0001-support-second-theme-and-runtime-swapping.patch b/.config/sys/etc/portage/patches/x11-terms/st/0001-support-second-theme-and-runtime-swapping.patch @@ -0,0 +1,42 @@ +From 32c7373697e60ff0449b6f30c071855e721e0f5e Mon Sep 17 00:00:00 2001 +From: Randy Palamar <palamar@ualberta.ca> +Date: Tue, 24 Oct 2023 06:06:03 -0600 +Subject: [PATCH] support second theme and runtime swapping + +--- + x.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/x.c b/x.c +index b36fb8c..bed68ef 100644 +--- a/x.c ++++ b/x.c +@@ -59,6 +59,7 @@ static void zoom(const Arg *); + static void zoomabs(const Arg *); + static void zoomreset(const Arg *); + static void ttysend(const Arg *); ++static void recolor(const Arg *); + + /* config.h for applying patches and the configuration. */ + #include "config.h" +@@ -1911,6 +1912,17 @@ resize(XEvent *e) + cresize(e->xconfigure.width, e->xconfigure.height); + } + ++void ++recolor(const Arg *A) ++{ ++ if (colorname == colordark) ++ colorname = colorlight; ++ else ++ colorname = colordark; ++ xloadcols(); ++ redraw(); ++} ++ + void + run(void) + { +-- +2.42.0 + diff --git a/.config/sys/etc/portage/patches/x11-terms/st/0002-support-setting-the-default-font-size-on-invocation.patch b/.config/sys/etc/portage/patches/x11-terms/st/0002-support-setting-the-default-font-size-on-invocation.patch @@ -0,0 +1,79 @@ +From 480c18ef43128e7801dc781fdab9513edc63414d Mon Sep 17 00:00:00 2001 +From: Randy Palamar <palamar@ualberta.ca> +Date: Thu, 25 Feb 2021 23:53:47 -0700 +Subject: [PATCH] support setting the default font size on invocation + +--- + st.1 | 8 ++++++++ + x.c | 8 +++++++- + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/st.1 b/st.1 +index 39120b4..57ddfb8 100644 +--- a/st.1 ++++ b/st.1 +@@ -22,6 +22,8 @@ st \- simple terminal + .IR line ] + .RB [ \-w + .IR windowid ] ++.RB [ \-z ++.IR fontsize ] + .RB [[ \-e ] + .IR command + .RI [ arguments ...]] +@@ -44,6 +46,8 @@ st \- simple terminal + .IR title ] + .RB [ \-w + .IR windowid ] ++.RB [ \-z ++.IR fontsize ] + .RB \-l + .IR line + .RI [ stty_args ...] +@@ -91,6 +95,10 @@ defines the window title (default 'st'). + embeds st within the window identified by + .I windowid + .TP ++.BI \-z " fontsize" ++sets the default fontsize to ++.I fontsize ++.TP + .BI \-l " line" + use a tty + .I line +diff --git a/x.c b/x.c +index bed68ef..58789c7 100644 +--- a/x.c ++++ b/x.c +@@ -4,6 +4,7 @@ + #include <limits.h> + #include <locale.h> + #include <signal.h> ++#include <stdlib.h> + #include <sys/select.h> + #include <time.h> + #include <unistd.h> +@@ -1146,7 +1147,7 @@ xinit(int cols, int rows) + die("could not init fontconfig.\n"); + + usedfont = (opt_font == NULL)? font : opt_font; +- xloadfonts(usedfont, 0); ++ xloadfonts(usedfont, defaultfontsize); + + /* colors */ + xw.cmap = XDefaultColormap(xw.dpy, xw.scr); +@@ -2086,6 +2087,11 @@ main(int argc, char *argv[]) + case 'v': + die("%s " VERSION "\n", argv0); + break; ++ case 'z': ++ defaultfontsize = strtod(EARGF(usage()), NULL); ++ if (!(defaultfontsize > 0)) ++ usage(); ++ break; + default: + usage(); + } ARGEND; +-- +2.42.0 + diff --git a/.config/sys/etc/portage/patches/x11-terms/st/0003-open-in-cwd.patch b/.config/sys/etc/portage/patches/x11-terms/st/0003-open-in-cwd.patch @@ -0,0 +1,128 @@ +From e001e353ba52a0d05b472ca9681b76bdebb13822 Mon Sep 17 00:00:00 2001 +From: Randy Palamar <palamar@ualberta.ca> +Date: Tue, 24 Oct 2023 06:02:54 -0600 +Subject: [PATCH] open in cwd + +--- + config.def.h | 1 + + st.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- + st.h | 1 + + 3 files changed, 52 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index 91ab8ca..7c75246 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -201,6 +201,7 @@ static Shortcut shortcuts[] = { + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, ++ { TERMMOD, XK_Return, newterm, {.i = 0} }, + }; + + /* +diff --git a/st.c b/st.c +index d6478f5..1ff98e7 100644 +--- a/st.c ++++ b/st.c +@@ -20,6 +20,8 @@ + #include "st.h" + #include "win.h" + ++extern char *argv0; ++ + #if defined(__linux) + #include <pty.h> + #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) +@@ -28,6 +30,10 @@ + #include <libutil.h> + #endif + ++#if defined(__OpenBSD__) ++ #include <sys/sysctl.h> ++#endif ++ + /* Arbitrary sizes */ + #define UTF_INVALID 0xFFFD + #define UTF_SIZ 4 +@@ -796,7 +802,7 @@ ttynew(const char *line, char *cmd, const char *out, char **args) + if (s > 2) + close(s); + #ifdef __OpenBSD__ +- if (pledge("stdio getpw proc exec", NULL) == -1) ++ if (pledge("stdio getpw proc ps exec", NULL) == -1) + die("pledge\n"); + #endif + execsh(cmd, args); +@@ -806,6 +812,7 @@ ttynew(const char *line, char *cmd, const char *out, char **args) + if (pledge("stdio rpath tty proc", NULL) == -1) + die("pledge\n"); + #endif ++ fcntl(m, F_SETFD, FD_CLOEXEC); + close(s); + cmdfd = m; + signal(SIGCHLD, sigchld); +@@ -1054,6 +1061,48 @@ tswapscreen(void) + tfulldirt(); + } + ++static int ++chdir_by_pid(pid_t pid) ++{ ++ char buf[32]; ++ ++#if defined(__linux) ++ snprintf(buf, sizeof(buf), "/proc/%ld/cwd", (long)pid); ++#elif defined(__OpenBSD__) ++ size_t sz = 32; ++ int name[3] = {CTL_KERN, KERN_PROC_CWD, pid}; ++ if (sysctl(name, 3, buf, &sz, 0, 0) == -1) ++ return -1; ++#endif ++ return chdir(buf); ++} ++ ++void ++newterm(const Arg* a) ++{ ++ int res; ++ switch (fork()) { ++ case -1: ++ die("fork failed: %s\n", strerror(errno)); ++ break; ++ case 0: ++ switch (fork()) { ++ case -1: ++ die("fork failed: %s\n", strerror(errno)); ++ break; ++ case 0: ++ chdir_by_pid(pid); ++ execlp("/proc/self/exe", argv0, NULL); ++ exit(1); ++ break; ++ default: ++ exit(0); ++ } ++ default: ++ wait(NULL); ++ } ++} ++ + void + tscrolldown(int orig, int n) + { +diff --git a/st.h b/st.h +index fd3b0d8..f2b03b0 100644 +--- a/st.h ++++ b/st.h +@@ -81,6 +81,7 @@ void die(const char *, ...); + void redraw(void); + void draw(void); + ++void newterm(const Arg *); + void printscreen(const Arg *); + void printsel(const Arg *); + void sendbreak(const Arg *); +-- +2.42.0 + diff --git a/.config/sys/etc/portage/patches/x11-terms/st/0004-split-borderpx-into-x-and-y-components.patch b/.config/sys/etc/portage/patches/x11-terms/st/0004-split-borderpx-into-x-and-y-components.patch @@ -0,0 +1,218 @@ +From 633516be81f66e74e51513867f3d867e6e23d713 Mon Sep 17 00:00:00 2001 +From: Randy Palamar <palamar@ualberta.ca> +Date: Tue, 24 Oct 2023 05:57:20 -0600 +Subject: [PATCH] split borderpx into x and y components + +--- + config.def.h | 2 +- + x.c | 82 ++++++++++++++++++++++++++++++++-------------------- + 2 files changed, 51 insertions(+), 33 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 7c75246..e26287b 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -6,7 +6,7 @@ + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ + static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; +-static int borderpx = 2; ++static struct { int x, y; } pad = { 12, 12 }; + + /* + * What program is execed by st depends of these precedence rules: +diff --git a/x.c b/x.c +index 58789c7..8530a28 100644 +--- a/x.c ++++ b/x.c +@@ -61,6 +61,8 @@ static void zoomabs(const Arg *); + static void zoomreset(const Arg *); + static void ttysend(const Arg *); + static void recolor(const Arg *); ++static void xpadinc(const Arg *); ++static void ypadinc(const Arg *); + + /* config.h for applying patches and the configuration. */ + #include "config.h" +@@ -333,7 +335,7 @@ ttysend(const Arg *arg) + int + evcol(XEvent *e) + { +- int x = e->xbutton.x - borderpx; ++ int x = e->xbutton.x - pad.x; + LIMIT(x, 0, win.tw - 1); + return x / win.cw; + } +@@ -341,7 +343,7 @@ evcol(XEvent *e) + int + evrow(XEvent *e) + { +- int y = e->xbutton.y - borderpx; ++ int y = e->xbutton.y - pad.y; + LIMIT(y, 0, win.th - 1); + return y / win.ch; + } +@@ -736,8 +738,8 @@ cresize(int width, int height) + if (height != 0) + win.h = height; + +- col = (win.w - 2 * borderpx) / win.cw; +- row = (win.h - 2 * borderpx) / win.ch; ++ col = (win.w - 2 * pad.x) / win.cw; ++ row = (win.h - 2 * pad.y) / win.ch; + col = MAX(1, col); + row = MAX(1, row); + +@@ -873,10 +875,10 @@ xhints(void) + sizeh->width = win.w; + sizeh->height_inc = win.ch; + sizeh->width_inc = win.cw; +- sizeh->base_height = 2 * borderpx; +- sizeh->base_width = 2 * borderpx; +- sizeh->min_height = win.ch + 2 * borderpx; +- sizeh->min_width = win.cw + 2 * borderpx; ++ sizeh->base_height = 2 * pad.y; ++ sizeh->base_width = 2 * pad.x; ++ sizeh->min_height = win.ch + 2 * pad.y; ++ sizeh->min_width = win.cw + 2 * pad.x; + if (xw.isfixed) { + sizeh->flags |= PMaxSize; + sizeh->min_width = sizeh->max_width = win.w; +@@ -1154,8 +1156,8 @@ xinit(int cols, int rows) + xloadcols(); + + /* adjust fixed window geometry */ +- win.w = 2 * borderpx + cols * win.cw; +- win.h = 2 * borderpx + rows * win.ch; ++ win.w = 2 * pad.x + cols * win.cw; ++ win.h = 2 * pad.y + rows * win.ch; + if (xw.gm & XNegative) + xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; + if (xw.gm & YNegative) +@@ -1244,7 +1246,7 @@ xinit(int cols, int rows) + int + xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y) + { +- float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp; ++ float winx = pad.x + x * win.cw, winy = pad.y + y * win.ch, xp, yp; + ushort mode, prevmode = USHRT_MAX; + Font *font = &dc.font; + int frcflags = FRC_NORMAL; +@@ -1377,7 +1379,7 @@ void + xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y) + { + int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); +- int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, ++ int winx = pad.x + x * win.cw, winy = pad.y + y * win.ch, + width = charlen * win.cw; + Color *fg, *bg, *temp, revfg, revbg, truefg, truebg; + XRenderColor colfg, colbg; +@@ -1467,17 +1469,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i + + /* Intelligent cleaning up of the borders. */ + if (x == 0) { +- xclear(0, (y == 0)? 0 : winy, borderpx, ++ xclear(0, (y == 0)? 0 : winy, pad.y, + winy + win.ch + +- ((winy + win.ch >= borderpx + win.th)? win.h : 0)); ++ ((winy + win.ch >= pad.y + win.th)? win.h : 0)); + } +- if (winx + width >= borderpx + win.tw) { ++ if (winx + width >= pad.x + win.tw) { + xclear(winx + width, (y == 0)? 0 : winy, win.w, +- ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch))); ++ ((winy + win.ch >= pad.y + win.th)? win.h : (winy + win.ch))); + } + if (y == 0) +- xclear(winx, 0, winx + width, borderpx); +- if (winy + win.ch >= borderpx + win.th) ++ xclear(winx, 0, winx + width, pad.x); ++ if (winy + win.ch >= pad.y + win.th) + xclear(winx, winy + win.ch, winx + width, win.h); + + /* Clean up the region we want to draw to. */ +@@ -1571,35 +1573,35 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) + case 3: /* Blinking Underline */ + case 4: /* Steady Underline */ + XftDrawRect(xw.draw, &drawcol, +- borderpx + cx * win.cw, +- borderpx + (cy + 1) * win.ch - \ ++ pad.x + cx * win.cw, ++ pad.y + (cy + 1) * win.ch - \ + cursorthickness, + win.cw, cursorthickness); + break; + case 5: /* Blinking bar */ + case 6: /* Steady bar */ + XftDrawRect(xw.draw, &drawcol, +- borderpx + cx * win.cw, +- borderpx + cy * win.ch, ++ pad.x + cx * win.cw, ++ pad.y + cy * win.ch, + cursorthickness, win.ch); + break; + } + } else { + XftDrawRect(xw.draw, &drawcol, +- borderpx + cx * win.cw, +- borderpx + cy * win.ch, ++ pad.x + cx * win.cw, ++ pad.y + cy * win.ch, + win.cw - 1, 1); + XftDrawRect(xw.draw, &drawcol, +- borderpx + cx * win.cw, +- borderpx + cy * win.ch, ++ pad.x + cx * win.cw, ++ pad.y + cy * win.ch, + 1, win.ch - 1); + XftDrawRect(xw.draw, &drawcol, +- borderpx + (cx + 1) * win.cw - 1, +- borderpx + cy * win.ch, ++ pad.x + (cx + 1) * win.cw - 1, ++ pad.y + cy * win.ch, + 1, win.ch - 1); + XftDrawRect(xw.draw, &drawcol, +- borderpx + cx * win.cw, +- borderpx + (cy + 1) * win.ch - 1, ++ pad.x + cx * win.cw, ++ pad.y + (cy + 1) * win.ch - 1, + win.cw, 1); + } + } +@@ -1694,8 +1696,8 @@ xximspot(int x, int y) + if (xw.ime.xic == NULL) + return; + +- xw.ime.spot.x = borderpx + x * win.cw; +- xw.ime.spot.y = borderpx + (y + 1) * win.ch; ++ xw.ime.spot.x = pad.x + x * win.cw; ++ xw.ime.spot.y = pad.y + (y + 1) * win.ch; + + XSetICValues(xw.ime.xic, XNPreeditAttributes, xw.ime.spotlist, NULL); + } +@@ -1913,6 +1915,22 @@ resize(XEvent *e) + cresize(e->xconfigure.width, e->xconfigure.height); + } + ++void ++xpadinc(const Arg *A) ++{ ++ pad.x += A->i; ++ cresize(0, 0); ++ redraw(); ++} ++ ++void ++ypadinc(const Arg *A) ++{ ++ pad.y += A->i; ++ cresize(0, 0); ++ redraw(); ++} ++ + void + recolor(const Arg *A) + { +-- +2.42.0 + diff --git a/.config/sys/etc/portage/patches/x11-terms/st/st-defaultfontsize-20210225-4ef0cbd.diff b/.config/sys/etc/portage/patches/x11-terms/st/st-defaultfontsize-20210225-4ef0cbd.diff @@ -1,79 +0,0 @@ -From e3c97b85f0e94011e77af9259d379c956f9d6d64 Mon Sep 17 00:00:00 2001 -From: Randy Palamar <palamar@ualberta.ca> -Date: Thu, 25 Feb 2021 23:53:47 -0700 -Subject: [PATCH] support setting the default font size on invocation - ---- - st.1 | 8 ++++++++ - x.c | 8 +++++++- - 2 files changed, 15 insertions(+), 1 deletion(-) - -diff --git a/st.1 b/st.1 -index 39120b4..57ddfb8 100644 ---- a/st.1 -+++ b/st.1 -@@ -22,6 +22,8 @@ st \- simple terminal - .IR line ] - .RB [ \-w - .IR windowid ] -+.RB [ \-z -+.IR fontsize ] - .RB [[ \-e ] - .IR command - .RI [ arguments ...]] -@@ -44,6 +46,8 @@ st \- simple terminal - .IR title ] - .RB [ \-w - .IR windowid ] -+.RB [ \-z -+.IR fontsize ] - .RB \-l - .IR line - .RI [ stty_args ...] -@@ -91,6 +95,10 @@ defines the window title (default 'st'). - embeds st within the window identified by - .I windowid - .TP -+.BI \-z " fontsize" -+sets the default fontsize to -+.I fontsize -+.TP - .BI \-l " line" - use a tty - .I line -diff --git a/x.c b/x.c -index 120e495..224f26e 100644 ---- a/x.c -+++ b/x.c -@@ -4,6 +4,7 @@ - #include <limits.h> - #include <locale.h> - #include <signal.h> -+#include <stdlib.h> - #include <sys/select.h> - #include <time.h> - #include <unistd.h> -@@ -1114,7 +1115,7 @@ xinit(int cols, int rows) - die("could not init fontconfig.\n"); - - usedfont = (opt_font == NULL)? font : opt_font; -- xloadfonts(usedfont, 0); -+ xloadfonts(usedfont, defaultfontsize); - - /* colors */ - xw.cmap = XDefaultColormap(xw.dpy, xw.scr); -@@ -2038,6 +2039,11 @@ main(int argc, char *argv[]) - case 'v': - die("%s " VERSION "\n", argv0); - break; -+ case 'z': -+ defaultfontsize = strtod(EARGF(usage()), NULL); -+ if (!(defaultfontsize > 0)) -+ usage(); -+ break; - default: - usage(); - } ARGEND; --- -2.26.2 - diff --git a/.config/sys/etc/portage/patches/x11-terms/st/st-recolor.patch b/.config/sys/etc/portage/patches/x11-terms/st/st-recolor.patch @@ -1,30 +0,0 @@ -diff --git a/x.c b/x.c -index 2a3bd38..c27db55 100644 ---- a/x.c -+++ b/x.c -@@ -59,6 +59,7 @@ static void zoom(const Arg *); - static void zoomabs(const Arg *); - static void zoomreset(const Arg *); - static void ttysend(const Arg *); -+static void recolor(const Arg *); - - /* config.h for applying patches and the configuration. */ - #include "config.h" -@@ -1908,6 +1909,17 @@ resize(XEvent *e) - cresize(e->xconfigure.width, e->xconfigure.height); - } - -+void -+recolor(const Arg *A) -+{ -+ if (colorname == colordark) -+ colorname = colorlight; -+ else -+ colorname = colordark; -+ xloadcols(); -+ redraw(); -+} -+ - void - run(void) - { diff --git a/.config/sys/etc/portage/savedconfig/x11-terms/st-9999 b/.config/sys/etc/portage/savedconfig/x11-terms/st-9999 @@ -6,7 +6,7 @@ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ static char *font = "Go Mono:style=Regular:size=14:antialias=true:autohint=true"; -static int borderpx = 12; +static struct { int x, y; } pad = { 12, 12 }; /* * What program is execed by st depends of these precedence rules: @@ -221,8 +221,12 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Y, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - { TERMMOD, XK_I, recolor, {.i = 0} }, { TERMMOD, XK_Return, newterm, {.i = 0} }, + { TERMMOD, XK_I, recolor, {.i = 0} }, + { TERMMOD, XK_K, ypadinc, {.i = +20} }, + { TERMMOD, XK_J, ypadinc, {.i = -20} }, + { TERMMOD, XK_L, xpadinc, {.i = +20} }, + { TERMMOD, XK_H, xpadinc, {.i = -20} }, }; /*