aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Best <gbe@ring0.de>2010-11-19 17:13:13 +0100
committerGregor Best <gbe@ring0.de>2010-11-19 17:13:13 +0100
commitb61afd24be566d8c8d7d5310fdad973441139428 (patch)
tree62cc9e6dc70d60111a325c944022747ee1dbf170
parent70464e208060746ad9184dfc298005fff3035d72 (diff)
downloadst-b61afd24be566d8c8d7d5310fdad973441139428.tar.gz
st-b61afd24be566d8c8d7d5310fdad973441139428.zip
Add -c option to override the default window class
-rw-r--r--st.14
-rw-r--r--st.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/st.1 b/st.1
index 4d00d2f..29bdda6 100644
--- a/st.1
+++ b/st.1
@@ -4,6 +4,7 @@ st \- simple terminal
4.SH SYNOPSIS 4.SH SYNOPSIS
5.B st 5.B st
6.RB [ \-e " <cmd>"] 6.RB [ \-e " <cmd>"]
7.RB [ \-c " <class>"]
7.RB [ \-t " <title>"] 8.RB [ \-t " <title>"]
8.RB [ \-v ] 9.RB [ \-v ]
9.SH DESCRIPTION 10.SH DESCRIPTION
@@ -17,5 +18,8 @@ Execute cmd instead of the shell
17.B \-t <title> 18.B \-t <title>
18Overrides the default title (st) 19Overrides the default title (st)
19.TP 20.TP
21.B \-c <class>
22Overrides the default class ($TERM)
23.TP
20.BI \-v 24.BI \-v
21Prints version information to standard output, then exits. 25Prints version information to standard output, then exits.
diff --git a/st.c b/st.c
index b25fe89..bed7e8d 100644
--- a/st.c
+++ b/st.c
@@ -31,7 +31,7 @@
31 31
32#define USAGE \ 32#define USAGE \
33 "st-" VERSION ", (c) 2010 st engineers\n" \ 33 "st-" VERSION ", (c) 2010 st engineers\n" \
34 "usage: st [-t title] [-e cmd] [-v]\n" 34 "usage: st [-t title] [-c class] [-e cmd] [-v]\n"
35 35
36/* Arbitrary sizes */ 36/* Arbitrary sizes */
37#define ESC_TITLE_SIZ 256 37#define ESC_TITLE_SIZ 256
@@ -252,6 +252,7 @@ static pid_t pid;
252static Selection sel; 252static Selection sel;
253static char *opt_cmd = NULL; 253static char *opt_cmd = NULL;
254static char *opt_title = NULL; 254static char *opt_title = NULL;
255static char *opt_class = NULL;
255 256
256/* UTF-8 decode */ 257/* UTF-8 decode */
257static int stou(char *s, long *u) { 258static int stou(char *s, long *u) {
@@ -1443,7 +1444,7 @@ xclear(int x1, int y1, int x2, int y2) {
1443void 1444void
1444xhints(void) 1445xhints(void)
1445{ 1446{
1446 XClassHint class = {TNAME, TNAME}; 1447 XClassHint class = {opt_class ? opt_class : TNAME, TNAME};
1447 XWMHints wm = {.flags = InputHint, .input = 1}; 1448 XWMHints wm = {.flags = InputHint, .input = 1};
1448 XSizeHints size = { 1449 XSizeHints size = {
1449 .flags = PSize | PResizeInc | PBaseSize, 1450 .flags = PSize | PResizeInc | PBaseSize,
@@ -1838,6 +1839,9 @@ main(int argc, char *argv[]) {
1838 case 't': 1839 case 't':
1839 if(++i < argc) opt_title = argv[i]; 1840 if(++i < argc) opt_title = argv[i];
1840 break; 1841 break;
1842 case 'c':
1843 if(++i < argc) opt_class = argv[i];
1844 break;
1841 case 'e': 1845 case 'e':
1842 if(++i < argc) opt_cmd = argv[i]; 1846 if(++i < argc) opt_cmd = argv[i];
1843 break; 1847 break;