Commit Diff


commit - 6bb186a7bcccf5882d7f4f146328ea1026b8b505
commit + 54fabaa42a665d1b27c59376f69e8e293f536fb9
blob - 5d14b0a57ed0515365cce4b03eb7822f651b40a1
blob + 7092f53491abb25c4d5689576e3a2f2bb26dc7d8
--- mymenu.1
+++ mymenu.1
@@ -8,24 +8,24 @@
 .Nm
 .Bk -words
 .Op Fl Aamvh
-.Op Fl p Ar prompt
-.Op Fl x Ar coord
-.Op Fl y Ar coord
-.Op Fl W Ar width
+.Op Fl B Ar colors
+.Op Fl b Ar borders
+.Op Fl C Ar color
+.Op Fl c Ar color
+.Op Fl d Ar separator
+.Op Fl e Ar window
+.Op Fl f Ar font
 .Op Fl H Ar height
-.Op Fl P Ar padding
 .Op Fl l Ar layout
-.Op Fl f Ar font
-.Op Fl b Ar borders
-.Op Fl B Ar colors
-.Op Fl t Ar color
+.Op Fl P Ar padding
+.Op Fl p Ar prompt
 .Op Fl T Ar color
-.Op Fl c Ar color
-.Op Fl C Ar color
-.Op Fl s Ar color
+.Op Fl t Ar color
 .Op Fl S Ar color
-.Op Fl e Ar window
-.Op Fl d Ar separator
+.Op Fl s Ar color
+.Op Fl W Ar width
+.Op Fl x Ar coord
+.Op Fl y Ar coord
 .Ek
 .Sh DESCRIPTION
 The
@@ -40,60 +40,62 @@ The following options are available and take the maxim
 over the (respective) ones defined in the
 .Sy X Resource Database
 .Bl -tag -width indent-two
-.It Fl h
-Print a small usage message to stderr.
-.It Fl v
-Print version and exit.
-.It Fl a
-The first completion (if any) is always selected. This is like dmenu.
 .It Fl A
 The user must chose one of the option (or none) and is not able to
 arbitrary enter text
-.It Fl m
-The user can select multiple entry via C-m. Please consult
-.Sx KEYS
-for more info.
-.It Fl p Ar prompt
-Override the prompt
-.It Fl x Ar val
-Override the positioning on the X axis, parsed as the resource MyMenu.x
-.It Fl y Ar val
-Override the positioning on the Y axis, parsed as the resource MyMenu.y
-.It Fl P Ar padding
-Override the padding. See the MyMenu.padding resource.
-.It Fl l Ar layout
-Override the layout. Parsed as MyMenu.layout.
-.It Fl f Ar font
-Override the font. See MyMenu.font.
-.It Fl w Ar val
-Override the width. Parsed as MyMenu.width.
-.It Fl h Ar val
-Override the height. Parsed as MyMenu.height.
-.It Fl b Ar borders
-Override the borders size. Parsed as MyMenu.border.size.
+.It Fl a
+The first completion (if any) is always selected. This is like dmenu.
 .It Fl B Ar colors
 Override the borders color. Parsed as MyMenu.border.color.
-.It Fl t Ar color
-Override the prompt foreground color. See MyMenu.prompt.foreground.
-.It Fl T Ar color
-Override the prompt background color. See MyMenu.prompt.background.
-.It Fl c Ar color
-Override the completion foreground color. See
-MyMenu.completion.foreground.
+.It Fl b Ar borders
+Override the borders size. Parsed as MyMenu.border.size.
 .It Fl C Ar color
 Override the completion background color. See
 MyMenu.completion.background.
-.It Fl s Ar color
-Override the highlighted completion foreground color. See
-MyMenu.completion_highlighted.foreground.
+.It Fl c Ar color
+Override the completion foreground color. See
+MyMenu.completion.foreground.
+.It Fl d Ar separator
+Define a string to be used as a separator. Only the text after the
+separator will be rendered, but the original string will be
+returned. Useful to embed custom data on every entry. See the mpd
+example for hints on how this can be useful.
+.It Fl e Ar windowid
+Embed into the given window id.
+.It Fl H Ar val
+Override the height. Parsed as MyMenu.height.
+.It Fl h
+Print a small usage message to stderr.
+.It Fl f Ar font
+Override the font. See MyMenu.font.
+.It Fl l Ar layout
+Override the layout. Parsed as MyMenu.layout.
+.It Fl m
+The user can select multiple entry via C-m. Please consult
+.It Fl P Ar padding
+Override the padding. See the MyMenu.padding resource.
+.It Fl p Ar prompt
+Override the prompt
 .It Fl S Ar color
 Override the highlighted completion background color. See
 MyMenu.completion_highlighted.background.
-.It Fl w Ar window
-Embed into the given window id.
-.It Fl d Ar sep
-Optionally show only the text after the given separator. Defaults
-to the whole line if the separator is not present.
+.It Fl s Ar color
+Override the highlighted completion foreground color. See
+MyMenu.completion_highlighted.foreground.
+.It Fl T Ar color
+Override the prompt background color. See MyMenu.prompt.background.
+.It Fl t Ar color
+Override the prompt foreground color. See MyMenu.prompt.foreground.
+.It Fl v
+Print version and exit.
+.Sx KEYS
+for more info.
+.It Fl W Ar val
+Override the width. Parsed as MyMenu.width.
+.It Fl x Ar val
+Override the positioning on the X axis, parsed as the resource MyMenu.x
+.It Fl y Ar val
+Override the positioning on the Y axis, parsed as the resource MyMenu.y
 .El
 .Sh RESOURCES
 .Bl -tag -width Ds
@@ -169,7 +171,18 @@ The background of the selected completion.
 .It MyMenu.completion_highlighted.foreground
 The foreground of the selected completion.
 .El
+.Sh COLORS
+MyMenu accept colors only in the form of:
+.Bl -bullet
+.It
+#rgb
+.It
+#rrggbb
+.It
+#aarrggbb
+.El
 
+The opacity is assumed 0xff (no transparency) if not provided.
 .Sh KEYS
 This is the list of keybinding recognized by
 .Li Nm Ns .
@@ -208,7 +221,6 @@ keybinding is a more elegant way to change, at runtime
 of the first completion.
 .El
 .Sh EXIT STATUS
-
 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
 if used with wrong flags and EX_UNAVAILABLE if the connection to X
 fails.
@@ -228,8 +240,8 @@ EOF
 .It
 Select and play a song from the current mpd playlist
 .Bd -literal -offset indent
-filter="%position%) %artist% - %title%"
-if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
+fmt="%position%) %artist% - %title%"
+if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d ") "); then
   mpc play $(echo $song | sed "s/).*$//")
 fi
 .Ed
blob - 07a7a5591b95688a662d300f3019b6f7d42081d2
blob + 9ffe7c35b2b163309c06b2e1722d78c60cfab138
--- mymenu.1.md
+++ mymenu.1.md
@@ -8,24 +8,24 @@ MYMENU(1) - General Commands Manual
 
 **mymenu**
 \[**-Aamvh**]
-\[**-p** *prompt*]
-\[**-x** *coord*]
-\[**-y** *coord*]
-\[**-W** *width*]
+\[**-B** *colors*]
+\[**-b** *borders*]
+\[**-C** *color*]
+\[**-c** *color*]
+\[**-d** *separator*]
+\[**-e** *window*]
+\[**-f** *font*]
 \[**-H** *height*]
-\[**-P** *padding*]
 \[**-l** *layout*]
-\[**-f** *font*]
-\[**-b** *borders*]
-\[**-B** *colors*]
-\[**-t** *color*]
+\[**-P** *padding*]
+\[**-p** *prompt*]
 \[**-T** *color*]
-\[**-c** *color*]
-\[**-C** *color*]
-\[**-s** *color*]
+\[**-t** *color*]
 \[**-S** *color*]
-\[**-e** *window*]
-\[**-d** *separator*]
+\[**-s** *color*]
+\[**-W** *width*]
+\[**-x** *coord*]
+\[**-y** *coord*]
 
 # DESCRIPTION
 
@@ -41,106 +41,108 @@ The following options are available and take the maxim
 over the (respective) ones defined in the
 **X Resource Database**
 
-**-h**
+**-A**
 
-> Print a small usage message to stderr.
+> The user must chose one of the option (or none) and is not able to
+> arbitrary enter text
 
-**-v**
-
-> Print version and exit.
-
 **-a**
 
 > The first completion (if any) is always selected. This is like dmenu.
 
-**-A**
+**-B** *colors*
 
-> The user must chose one of the option (or none) and is not able to
-> arbitrary enter text
+> Override the borders color. Parsed as MyMenu.border.color.
 
-**-m**
+**-b** *borders*
 
-> The user can select multiple entry via C-m. Please consult
-> *KEYS*
-> for more info.
+> Override the borders size. Parsed as MyMenu.border.size.
 
-**-p** *prompt*
+**-C** *color*
 
-> Override the prompt
+> Override the completion background color. See
+> MyMenu.completion.background.
 
-**-x** *val*
+**-c** *color*
 
-> Override the positioning on the X axis, parsed as the resource MyMenu.x
+> Override the completion foreground color. See
+> MyMenu.completion.foreground.
 
-**-y** *val*
+**-d** *separator*
 
-> Override the positioning on the Y axis, parsed as the resource MyMenu.y
+> Define a string to be used as a separator. Only the text after the
+> separator will be rendered, but the original string will be
+> returned. Useful to embed custom data on every entry. See the mpd
+> example for hints on how this can be useful.
 
-**-P** *padding*
+**-e** *windowid*
 
-> Override the padding. See the MyMenu.padding resource.
+> Embed into the given window id.
 
-**-l** *layout*
+**-H** *val*
 
-> Override the layout. Parsed as MyMenu.layout.
+> Override the height. Parsed as MyMenu.height.
 
+**-h**
+
+> Print a small usage message to stderr.
+
 **-f** *font*
 
 > Override the font. See MyMenu.font.
 
-**-w** *val*
+**-l** *layout*
 
-> Override the width. Parsed as MyMenu.width.
+> Override the layout. Parsed as MyMenu.layout.
 
-**-h** *val*
+**-m**
 
-> Override the height. Parsed as MyMenu.height.
+> The user can select multiple entry via C-m. Please consult
 
-**-b** *borders*
+**-P** *padding*
 
-> Override the borders size. Parsed as MyMenu.border.size.
+> Override the padding. See the MyMenu.padding resource.
 
-**-B** *colors*
+**-p** *prompt*
 
-> Override the borders color. Parsed as MyMenu.border.color.
+> Override the prompt
 
-**-t** *color*
+**-S** *color*
 
-> Override the prompt foreground color. See MyMenu.prompt.foreground.
+> Override the highlighted completion background color. See
+> MyMenu.completion\_highlighted.background.
 
+**-s** *color*
+
+> Override the highlighted completion foreground color. See
+> MyMenu.completion\_highlighted.foreground.
+
 **-T** *color*
 
 > Override the prompt background color. See MyMenu.prompt.background.
 
-**-c** *color*
+**-t** *color*
 
-> Override the completion foreground color. See
-> MyMenu.completion.foreground.
+> Override the prompt foreground color. See MyMenu.prompt.foreground.
 
-**-C** *color*
+**-v**
 
-> Override the completion background color. See
-> MyMenu.completion.background.
+> Print version and exit.
+> *KEYS*
+> for more info.
 
-**-s** *color*
+**-W** *val*
 
-> Override the highlighted completion foreground color. See
-> MyMenu.completion\_highlighted.foreground.
+> Override the width. Parsed as MyMenu.width.
 
-**-S** *color*
+**-x** *val*
 
-> Override the highlighted completion background color. See
-> MyMenu.completion\_highlighted.background.
+> Override the positioning on the X axis, parsed as the resource MyMenu.x
 
-**-w** *window*
+**-y** *val*
 
-> Embed into the given window id.
+> Override the positioning on the Y axis, parsed as the resource MyMenu.y
 
-**-d** *sep*
-
-> Optionally show only the text after the given separator. Defaults
-> to the whole line if the separator is not present.
-
 # RESOURCES
 
 MyMenu.font
@@ -250,6 +252,18 @@ MyMenu.completion\_highlighted.foreground
 
 > The foreground of the selected completion.
 
+# COLORS
+
+MyMenu accept colors only in the form of:
+
+*	#rgb
+
+*	#rrggbb
+
+*	#aarrggbb
+
+The opacity is assumed 0xff (no transparency) if not provided.
+
 # KEYS
 
 This is the list of keybinding recognized by
@@ -333,8 +347,8 @@ fails.
 
 *	Select and play a song from the current mpd playlist
 
-		filter="%position%) %artist% - %title%"
-		if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
+		fmt="%position%) %artist% - %title%"
+		if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d ") "); then
 		  mpc play $(echo $song | sed "s/).*$//")
 		fi
 
@@ -368,4 +382,4 @@ Omar Polo <omar.polo@europecom.net>
 	height of the window, remember to override the x and y coordinates as
 	well.
 
-OpenBSD 6.3 - August 13, 2018
+OpenBSD 6.4 - September 16, 2018
blob - c3c2f7522465f535e59040da63b9729c8b8ed3ef
blob + 5d7e58e4aaf497fa9135558aa218a19b681f45a9
--- mymenu.c
+++ mymenu.c
@@ -883,10 +883,10 @@ enum action parse_event(Display *d, XKeyPressedEvent *
 
 // Given the name of the program (argv[0]?) print a small help on stderr
 void usage(char *prgname) {
-  fprintf(stderr, "%s [-hvam] [-p prompt] [-x coord] [-y coord] [-W width] [-H height]\n"
-                  "       [-P padding] [-l layout] [-f font] [-b borders] [-B colors]\n"
-                  "       [-t color] [-T color] [-c color] [-C color] [-s color] [-S color]\n"
-                  "       [-e window_id]\n", prgname);
+  fprintf(stderr, "%s [-Aamvh] [-B colors] [-b borders] [-C color] [-c color]\n"
+                  "       [-d separator] [-e window] [-f font] [-H height] [-l layout]\n"
+                  "       [-P padding] [-p prompt] [-T color] [-t color] [-S color]\n"
+                  "       [-s color] [-W width] [-x coord] [-y coord]\n", prgname);
 }
 
 // small function used in the event loop