[dev] [PATCH] Add -g (geometry) option to tabbed.

From: Thorsten Glaser <tg_AT_mirbsd.de>
Date: Tue, 20 Aug 2013 14:20:08 +0200

Signed-off-by: Thorsten Glaser <t.glaser_AT_tarent.de>
---
 LICENSE  | 1 +
 tabbed.1 | 5 +++++
 tabbed.c | 8 ++++++++
 3 files changed, 14 insertions(+)
diff --git a/LICENSE b/LICENSE
index add8a53..b8dc9ea 100644
--- a/LICENSE
+++ b/LICENSE
_AT_@ -3,6 +3,7 @@ MIT/X Consortium License
 © 2009-2011 Enno Boland <g s01 de>
 © 2011 Connor Lane Smith <cls_AT_lubutu.com>
 © 2012 Christoph Lohmann <20h_AT_r-36.net> 
+© 2013 Thorsten “mirabilos” Glaser <t.glaser_AT_tarent.de>
 
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
diff --git a/tabbed.1 b/tabbed.1
index d3ef06a..a315136 100644
--- a/tabbed.1
+++ b/tabbed.1
_AT_@ -8,6 +8,8 @@ tabbed \- generic tabbed interface
 .RB [ \-h ]
 .RB [ \-s ]
 .RB [ \-v ]
+.RB [ \-g
+.IR geometry ]
 .RB [ \-n
 .IR name ]
 .RB [ \-p
_AT_@ -34,6 +36,9 @@ detaches tabbed from the terminal and prints its XID to stdout.
 fill up tabbed again by spawning the provided command, when the last tab is
 closed. Mutually exclusive with -c.
 .TP
+.BI \-g " geometry"
+specifies the preferred size and position of the parent window.
+.TP
 .B \-h
 will print the usage of tabbed.
 .TP
diff --git a/tabbed.c b/tabbed.c
index ba1df21..64dcd2a 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -160,6 +160,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
 static char winid[64];
 static char **cmd = NULL;
 static char *wmname = "tabbed";
+static const char *geometry = NULL;
 
 char *argv0;
 
_AT_@ -890,6 +891,10 @@ setup(void) {
 	ww = 800;
 	wh = 600;
 
+	if (geometry)
+		XParseGeometry(geometry, &wx, &wy,
+		    (unsigned *)&ww, (unsigned *)&wh);
+
 	dc.norm[ColBG] = getcolor(normbgcolor);
 	dc.norm[ColFG] = getcolor(normfgcolor);
 	dc.sel[ColBG] = getcolor(selbgcolor);
_AT_@ -1125,6 +1130,9 @@ main(int argc, char *argv[]) {
 	case 'f':
 		fillagain = True;
 		break;
+	case 'g':
+		geometry = EARGF(usage());
+		break;
 	case 'n':
 		wmname = EARGF(usage());
 		break;
-- 
1.8.4.rc3
Received on Tue Aug 20 2013 - 14:20:08 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 20 2013 - 14:24:09 CEST