Hello,
I'm very new to this mailing list, but have been using wmii for a year or so
now.
It's an awesome WM. Thank you very much for maintaining it.
Here's my humble contribution.
I found that some menu scripts that I've thrown together look much better
with
the items aligned to the left. As a result, I wrote a small patch to the
wmii9menu.c
which adds an optional -p flag and takes left right or centered as an
argument.
This allows the user to specify which way to align the items in the menu.
The diff follows. I'm not sure how people react to these things (I'm new to
all mailing
lists)... but hopefully this helps someone who might be looking for the same
thing.
Thanks again.
diff -r b767f9a84346 cmd/x11/wmii9menu.c
--- a/cmd/x11/wmii9menu.c Mon Aug 16 19:38:17 2010 -0400
+++ b/cmd/x11/wmii9menu.c Wed Aug 25 21:37:41 2010 -0400
@@ -71,6 +71,7 @@
static char** labels; /* list of labels and commands */
static char** commands;
static int numitems;
+static Align align;
void usage(void);
void run_menu(void);
@@ -108,11 +109,13 @@
main(int argc, char **argv)
{
static char *address;
+ static char *alignString;
char *cp;
int i;
g_argc = argc;
g_argv = argv;
+ align = Center;
ARGBEGIN{
case 'v':
@@ -124,6 +127,17 @@
case 'i':
initial = EARGF(usage());
break;
+ case 'p':
+ alignString = EARGF(usage());
+ align = (strcmp(alignString, "left") == 0) ? West :
+ (strcmp(alignString, "right") == 0) ? East :
+ (strcmp(alignString, "center") == 0) ? Center :
+ North;
+
+ if ( align == North )
+ usage();
+
+ break;
default:
usage();
}ARGEND;
@@ -173,7 +187,7 @@
usage(void)
{
lprint(2, "usage: %s -v\n", argv0);
- lprint(2, " %s [-a <address>] [-i <arg>] menitem[:command]
...\n", argv0);
+ lprint(2, " %s [-a <address>] [-i <arg>] [-p <left|center|right>]
menitem[:command] ...\n", argv0);
exit(0);
}
@@ -306,7 +320,7 @@
c = &cnorm;
r = rectsetorigin(r, Pt(0, i * high));
fill(menuwin, r, &c->bg);
- drawstring(menuwin, font, r, Center, labels[i], &c->fg);
+ drawstring(menuwin, font, r, align, labels[i], &c->fg);
}
}
diff -r b767f9a84346 man/wmii9menu.1
--- a/man/wmii9menu.1 Mon Aug 16 19:38:17 2010 -0400
+++ b/man/wmii9menu.1 Wed Aug 25 21:37:41 2010 -0400
@@ -29,8 +29,15 @@
line, it is selected at startup, and the menu is positioned
so that the mouse pointer is centered on said item.
.RE
-.P
-:
+.TP
+\-p \fI<left|center|right>\fR
+
+.RS
+Specifies the position of the menu items. If left is specified
+they are justified left. If right is specified they are justified
+right. If center is specified, or the \-p flag is omitted, then
+the items are centered.
+.RE
.SH USAGE
.P
diff -r b767f9a84346 man/wmii9menu.man1
--- a/man/wmii9menu.man1 Mon Aug 16 19:38:17 2010 -0400
+++ b/man/wmii9menu.man1 Wed Aug 25 21:37:41 2010 -0400
@@ -29,7 +29,11 @@
If <initial> is listed among the other items on the command
line, it is selected at startup, and the menu is positioned
so that the mouse pointer is centered on said item.
-:
+: -p <left|center|right>
+ Specifies the position of the menu items. If left is specified
+ they are justified left. If right is specified they are justified
+ right. If center is specified, or the -p flag is omitted, then
+ the items are centered.
= USAGE =
-- Regards, Vladimir LevinReceived on Thu Aug 26 2010 - 03:48:24 CEST
This archive was generated by hypermail 2.2.0 : Thu Aug 26 2010 - 04:00:05 CEST