On Thu, Jan 27, 2011 at 01:32:09PM -0600, Dan White wrote:
> I like this better, it makes it easy to use st for an interactive
> popup window. Was going dwm-style but the cmd line option generalizes
> this without much bloat.
I was thinking that, I got scratchpad functionality in dwm a little while ago
and was missing this option in st, your patch showed me how easy it was to
add it. Though I did update it after someone pointed out something stupid I was
doing (thank you!), but I apparently didn't send it to the list.
The update makes it a little cleaner :)
diff -r b76c819df66f st.c
--- a/st.c Tue Jan 11 23:33:21 2011 +0100
+++ b/st.c Thu Jan 27 17:12:21 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 = 24;
+static int opt_cols = 80;
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 * xw.ch;
+ xw.bufw = opt_cols * 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_rows);
ttynew();
xinit();
selinit();