aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2016-01-29 22:03:01 +0100
committerChristoph Lohmann <20h@r-36.net>2016-01-30 09:45:23 +0100
commit0cd5117a2cfc4134712de748ec416be0655838b2 (patch)
tree40f130bd62141fe15efd65992422ea84750b39ac
parentbd5fdbe64c8abfb624ad59939ed9b221c8b04eef (diff)
downloadst-patched-0cd5117a2cfc4134712de748ec416be0655838b2.tar.bz2
st-patched-0cd5117a2cfc4134712de748ec416be0655838b2.tar.xz
st-patched-0cd5117a2cfc4134712de748ec416be0655838b2.zip
Add -n option for setting WM_CLASS instance name
Signed-off-by: Christoph Lohmann <20h@r-36.net>
-rw-r--r--st.17
-rw-r--r--st.c34
2 files changed, 26 insertions, 15 deletions
diff --git a/st.1 b/st.1
index fe2e731..1e3f1d4 100644
--- a/st.1
+++ b/st.1
@@ -10,6 +10,8 @@ st \- simple terminal
10.IR font ] 10.IR font ]
11.RB [ \-g 11.RB [ \-g
12.IR geometry ] 12.IR geometry ]
13.RB [ \-n
14.IR name ]
13.RB [ \-o 15.RB [ \-o
14.IR iofile ] 16.IR iofile ]
15.RB [ \-T 17.RB [ \-T
@@ -32,6 +34,8 @@ st \- simple terminal
32.IR font ] 34.IR font ]
33.RB [ \-g 35.RB [ \-g
34.IR geometry ] 36.IR geometry ]
37.RB [ \-n
38.IR name ]
35.RB [ \-o 39.RB [ \-o
36.IR iofile ] 40.IR iofile ]
37.RB [ \-T 41.RB [ \-T
@@ -68,6 +72,9 @@ for further details.
68.B \-i 72.B \-i
69will fixate the position given with the -g option. 73will fixate the position given with the -g option.
70.TP 74.TP
75.BI \-n " name"
76defines the window instance name (default $TERM).
77.TP
71.BI \-o " iofile" 78.BI \-o " iofile"
72writes all the I/O to 79writes all the I/O to
73.I iofile. 80.I iofile.
diff --git a/st.c b/st.c
index 2bbf484..38abffb 100644
--- a/st.c
+++ b/st.c
@@ -524,14 +524,15 @@ static int cmdfd;
524static pid_t pid; 524static pid_t pid;
525static Selection sel; 525static Selection sel;
526static int iofd = 1; 526static int iofd = 1;
527static char **opt_cmd = NULL; 527static char **opt_cmd = NULL;
528static char *opt_io = NULL;
529static char *opt_title = NULL;
530static char *opt_embed = NULL;
531static char *opt_class = NULL; 528static char *opt_class = NULL;
532static char *opt_font = NULL; 529static char *opt_embed = NULL;
533static char *opt_line = NULL; 530static char *opt_font = NULL;
534static int oldbutton = 3; /* button event on startup: 3 = release */ 531static char *opt_io = NULL;
532static char *opt_line = NULL;
533static char *opt_name = NULL;
534static char *opt_title = NULL;
535static int oldbutton = 3; /* button event on startup: 3 = release */
535 536
536static char *usedfont = NULL; 537static char *usedfont = NULL;
537static double usedfontsize = 0; 538static double usedfontsize = 0;
@@ -3240,7 +3241,8 @@ xclear(int x1, int y1, int x2, int y2)
3240void 3241void
3241xhints(void) 3242xhints(void)
3242{ 3243{
3243 XClassHint class = {termname, opt_class ? opt_class : termname}; 3244 XClassHint class = {opt_name ? opt_name : termname,
3245 opt_class ? opt_class : termname};
3244 XWMHints wm = {.flags = InputHint, .input = 1}; 3246 XWMHints wm = {.flags = InputHint, .input = 1};
3245 XSizeHints *sizeh = NULL; 3247 XSizeHints *sizeh = NULL;
3246 3248
@@ -4332,13 +4334,12 @@ run(void)
4332void 4334void
4333usage(void) 4335usage(void)
4334{ 4336{
4335 die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]" 4337 die("usage: %s "
4336 " [-o file] [-T title]\n" 4338 "[-aiv] [-c class] [-f font] [-g geometry] [-n name] [-o file]\n "
4337 " [-t title] [-w windowid] [[-e] command [args ...]]\n" 4339 " [-T title] [-t title] [-w windowid] [[-e] command [args ...]\n "
4338 " %s [-aiv] [-c class] [-f font] [-g geometry]" 4340 " %s [-aiv] [-c class] [-f font] [-g geometry] [-n name] [-o file]\n "
4339 " [-o file] [-T title]\n" 4341 " [-o file] [-T title] [-t title] [-w windowid] -l line"
4340 " [-t title] [-w windowid] -l line [stty_args ...]\n", 4342 " [stty_args ...]\n", argv0, argv0);
4341 argv0, argv0);
4342} 4343}
4343 4344
4344void 4345void
@@ -4383,6 +4384,9 @@ main(int argc, char *argv[])
4383 case 'l': 4384 case 'l':
4384 opt_line = EARGF(usage()); 4385 opt_line = EARGF(usage());
4385 break; 4386 break;
4387 case 'n':
4388 opt_name = EARGF(usage());
4389 break;
4386 case 't': 4390 case 't':
4387 case 'T': 4391 case 'T':
4388 opt_title = EARGF(usage()); 4392 opt_title = EARGF(usage());