On Thu, Nov 18, 2010 at 08:43:15PM +0100, Moritz Wilhelmy wrote:
> [...]
> Why not call it -class? That way it's xterm-compatible.
> One could also think about renaming -t to -title.
> [...]

Well, I wanted to keep with the current style...

Also, a fixed version of the patch is attached (with correct \t usage
and manpage this time).

-- 
    $l="\n";$p=q-sub r{rand}sub c{((shift)**2+(shift)**2)<1}while(
    $i++<=$s){$t++if c r,r}die("Gregor Best, 0xDB9F9A7C, ".($t/$s*
    4).$l)-;$s+=ord$$|$_ for split //,$p;srand($s|$$);eval$p;die$@
# HG changeset patch
# User Gregor Best <g...@ring0.de>
# Date 1290183193 -3600
# Branch class
# Node ID 3551035ea8a6d3ef5388d587b118fb3ca0a9ed5b
# Parent  4cd71bc46f0fd25a2bdfd5c46815efc4d0f2612c
Add -c option to override the default window class

diff -r 4cd71bc46f0f -r 3551035ea8a6 st.1
--- a/st.1      Thu Nov 18 12:43:33 2010 +0100
+++ b/st.1      Fri Nov 19 17:13:13 2010 +0100
@@ -4,6 +4,7 @@
 .SH SYNOPSIS
 .B st
 .RB [ \-e " <cmd>"]
+.RB [ \-c " <class>"]
 .RB [ \-t " <title>"]
 .RB [ \-v ]
 .SH DESCRIPTION
@@ -17,5 +18,8 @@
 .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.
diff -r 4cd71bc46f0f -r 3551035ea8a6 st.c
--- a/st.c      Thu Nov 18 12:43:33 2010 +0100
+++ b/st.c      Fri Nov 19 17:13:13 2010 +0100
@@ -31,7 +31,7 @@
 
 #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 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,
@@ -1838,6 +1839,9 @@
                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];
                        break;

Attachment: pgpMEPwhdSE8f.pgp
Description: PGP signature

Reply via email to