On Sat, Jan 22, 2011 at 05:02:27PM -0600, Dan White wrote:
> I've been using st on and off for a bit. It's been great as a
> fast-start popup terminal. However, I go for 80x40 for most uses and
> made up this patch to make the initial geometry an option.
That was a very nice patch, it inspired me to write this one. I searched
through the mail archives, but couldn't find anything similar, hope it's ok.
diff -r b76c819df66f st.c
--- a/st.c Tue Jan 11 23:33:21 2011 +0100
+++ b/st.c Wed Jan 26 23:48:10 2011 +0100
@@ -32,7 +32,7 @@
#define USAGE \
"st-" VERSION ", (c) 2010 st engineers\n" \
- "usage: st [-t title] [-c class] [-e cmd] [-v]\n"
+ "usage: st [-t title] [-c class] [-g COLSxROWS] [-e cmd] [-v]\n"
/* Arbitrary sizes */
#define ESC_TITLE_SIZ 256
@@ -251,6 +251,8 @@
static char **opt_cmd = NULL;
static char *opt_title = NULL;
static char *opt_class = NULL;
+static int opt_rows = 0;
+static int opt_cols = 0;
int
utf8decode(char *s, long *u) {
@@ -1522,8 +1524,8 @@
xloadcols();
/* window - default size */
- xw.bufh = 24 * xw.ch;
- xw.bufw = 80 * xw.cw;
+ xw.bufh = (opt_rows ? opt_rows : 24) * xw.ch;
+ xw.bufw = (opt_cols ? opt_cols : 80) * xw.cw;
xw.h = xw.bufh + 2*BORDER;
xw.w = xw.bufw + 2*BORDER;
@@ -1860,6 +1862,9 @@
case 'c':
if(++i < argc) opt_class = argv[i];
break;
+ case 'g':
+ if(++i < argc) sscanf(argv[i], "%dx%d", &opt_cols,
&opt_rows);
+ break;
case 'e':
if(++i < argc) opt_cmd = &argv[i];
break;
@@ -1872,7 +1877,7 @@
break;
}
setlocale(LC_CTYPE, "");
- tnew(80, 24);
+ tnew(opt_cols ? opt_cols : 80, opt_rows ? opt_rows : 24);
ttynew();
xinit();
selinit();