st

My st build
git clone https://git.regexghost.com/st.git
Log | Files | Refs | README | LICENSE

commit b4c90785874c12a677d7828e63314e51f6069697
parent f5f2bf54c98cd8b9dd40b5af19705e6e76227074
Author: regexghost <regexghost@protonmail.com>
Date:   Thu, 23 Apr 2026 08:11:19 +0100

working dir patch

Diffstat:
Mst.1 | 8++++++++
Mx.c | 13+++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/st.1 b/st.1 @@ -6,6 +6,8 @@ st \- simple terminal .RB [ \-aiv ] .RB [ \-c .IR class ] +.RB [ \-d +.IR path ] .RB [ \-f .IR font ] .RB [ \-g @@ -30,6 +32,8 @@ st \- simple terminal .RB [ \-aiv ] .RB [ \-c .IR class ] +.RB [ \-d +.IR path ] .RB [ \-f .IR font ] .RB [ \-g @@ -58,6 +62,10 @@ disable alternate screens in terminal .BI \-c " class" defines the window class (default $TERM). .TP +.BI \-d " path" +changes the working directory to +.IR path . +.TP .BI \-f " font" defines the .I font diff --git a/x.c b/x.c @@ -255,6 +255,7 @@ static char *opt_io = NULL; static char *opt_line = NULL; static char *opt_name = NULL; static char *opt_title = NULL; +static char *opt_dir = NULL; static uint buttons; /* bit field of pressed buttons */ @@ -2047,12 +2048,12 @@ run(void) void usage(void) { - die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]" - " [-n name] [-o file]\n" + die("usage: %s [-aiv] [-c class] [-d path] [-f font]" + " [-g geometry] [-n name] [-o file]\n" " [-T title] [-t title] [-w windowid]" " [[-e] command [args ...]]\n" - " %s [-aiv] [-c class] [-f font] [-g geometry]" - " [-n name] [-o file]\n" + " %s [-aiv] [-c class] [-d path] [-f font]" + " [-g geometry] [-n name] [-o file]\n" " [-T title] [-t title] [-w windowid] -l line" " [stty_args ...]\n", argv0, argv0); } @@ -2104,6 +2105,9 @@ main(int argc, char *argv[]) case 'v': die("%s " VERSION "\n", argv0); break; + case 'd': + opt_dir = EARGF(usage()); + break; default: usage(); } ARGEND; @@ -2123,6 +2127,7 @@ run: xinit(cols, rows); xsetenv(); selinit(); + chdir(opt_dir); run(); return 0;