[dev] [tabbed] [PATCH] Add -n NAME option
In order to use tabbed in my Xmonad scratchpad, I needed to set the WM_CLASS
property. I added the -n option in this patch to allow this.
Use like: tabbed -n scratchpad xterm -into
# HG changeset patch
# User Gavin Wahl <gavinwahl_AT_gmail.com>
# Date 1349197533 21600
# Node ID 67bafeab0159d11514a4e99427dca3630f613a12
# Parent 2e9d8a5c62ccf0526326a0a9e101b0b476050da9
Add -n NAME option
Sets the X11 WM_CLASS attribute of the tabbed window
diff -r 2e9d8a5c62cc -r 67bafeab0159 tabbed.1
--- a/tabbed.1 Mon Aug 20 09:08:09 2012 +0200
+++ b/tabbed.1 Tue Oct 02 11:05:33 2012 -0600
_AT_@ -7,6 +7,8 @@
.RB [ \-h ]
.RB [ \-s ]
.RB [ \-v ]
+.RB [ \-n
+.IR name ]
.IR [ command ... ]
.SH DESCRIPTION
.B tabbed
_AT_@ -28,6 +30,9 @@
.TP
.B \-v
prints version information to stderr, then exits.
+.TP
+.B \-n name
+sets the WM_CLASS attribute to name.
.SH USAGE
.TP
.B Ctrl\-Shift\-Return
diff -r 2e9d8a5c62cc -r 67bafeab0159 tabbed.c
--- a/tabbed.c Mon Aug 20 09:08:09 2012 +0200
+++ b/tabbed.c Tue Oct 02 11:05:33 2012 -0600
_AT_@ -153,6 +153,7 @@
static int (*xerrorxlib)(Display *, XErrorEvent *);
static char winid[64];
static char **cmd = NULL;
+static char *wm_class = "tabbed";
char *argv0;
/* configuration, allows nested code to access above variables */
_AT_@ -762,7 +763,7 @@
StructureNotifyMask|SubstructureRedirectMask);
xerrorxlib = XSetErrorHandler(xerror);
XClassHint class_hint;
- class_hint.res_name = "tabbed";
+ class_hint.res_name = wm_class;
class_hint.res_class = "Tabbed";
XSetClassHint(dpy, win, &class_hint);
XSetWMProtocols(dpy, win, &wmatom[WMDelete], 1);
_AT_@ -878,7 +879,7 @@
void
usage(void)
{
- die("usage: %s [-dhsv] command...\n", argv0);
+ die("usage: %s [-dhsv] [-n name] command...\n", argv0);
}
int
_AT_@ -898,6 +899,9 @@
case 'd':
detach = 1;
break;
+ case 'n':
+ wm_class = EARGF(usage());
+ break;
} ARGEND;
if(argc < 1)
Received on Tue Oct 02 2012 - 19:11:48 CEST
This archive was generated by hypermail 2.3.0
: Tue Oct 02 2012 - 19:24:02 CEST