all repos — st @ b61afd24be566d8c8d7d5310fdad973441139428

st (suckless terminal) config

Add -c option to override the default window class
Gregor Best gbe@ring0.de
commit

b61afd24be566d8c8d7d5310fdad973441139428

parent

70464e208060746ad9184dfc298005fff3035d72

2 files changed, 10 insertions(+), 2 deletions(-)

jump to
M st.1st.1

@@ -4,6 +4,7 @@ st \- simple terminal

.SH SYNOPSIS .B st .RB [ \-e " <cmd>"] +.RB [ \-c " <class>"] .RB [ \-t " <title>"] .RB [ \-v ] .SH DESCRIPTION

@@ -16,6 +17,9 @@ Execute cmd instead of the shell

.TP .B \-t <title> Overrides the default title (st) +.TP +.B \-c <class> +Overrides the default class ($TERM) .TP .BI \-v Prints version information to standard output, then exits.
M st.cst.c

@@ -31,7 +31,7 @@ #endif

#define USAGE \ "st-" VERSION ", (c) 2010 st engineers\n" \ - "usage: st [-t title] [-e cmd] [-v]\n" + "usage: st [-t title] [-c class] [-e cmd] [-v]\n" /* Arbitrary sizes */ #define ESC_TITLE_SIZ 256

@@ -252,6 +252,7 @@ static pid_t pid;

static Selection sel; static char *opt_cmd = NULL; static char *opt_title = NULL; +static char *opt_class = NULL; /* UTF-8 decode */ static int stou(char *s, long *u) {

@@ -1443,7 +1444,7 @@

void xhints(void) { - XClassHint class = {TNAME, TNAME}; + XClassHint class = {opt_class ? opt_class : TNAME, TNAME}; XWMHints wm = {.flags = InputHint, .input = 1}; XSizeHints size = { .flags = PSize | PResizeInc | PBaseSize,

@@ -1837,6 +1838,9 @@ for(i = 1; i < argc; i++) {

switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) { case 't': if(++i < argc) opt_title = argv[i]; + break; + case 'c': + if(++i < argc) opt_class = argv[i]; break; case 'e': if(++i < argc) opt_cmd = argv[i];