6 .Nd simple menu for XOrg
33 utility a simple graphical menu for XOrg. It read the items from
35 and print the user selection to
39 The following options are available and take the maximum precedence
40 over the (respective) ones defined in the
41 .Sy X Resource Database
42 .Bl -tag -width indent-two
44 Print a small usage message to stderr.
46 Print version and exit.
48 The first completion (if any) is always selected. This is like dmenu.
50 The user must chose one of the option (or none) and is not able to
55 Override the positioning on the X axis, parsed as the resource MyMenu.x
57 Override the positioning on the Y axis, parsed as the resource MyMenu.y
59 Override the padding. See the MyMenu.padding resource.
61 Override the layout. Parsed as MyMenu.layout.
63 Override the font. See MyMenu.font.
65 Override the width. Parsed as MyMenu.width.
67 Override the height. Parsed as MyMenu.height.
69 Override the borders size. Parsed as MyMenu.border.size.
71 Override the borders color. Parsed as MyMenu.border.color.
73 Override the prompt foreground color. See MyMenu.prompt.foreground.
75 Override the prompt background color. See MyMenu.prompt.background.
77 Override the completion foreground color. See
78 MyMenu.completion.foreground.
80 Override the completion background color. See
81 MyMenu.completion.background.
83 Override the highlighted completion foreground color. See
84 MyMenu.completion_highlighted.foreground.
86 Override the highlighted completion background color. See
87 MyMenu.completion_highlighted.background.
89 Embed into the given window id.
91 Optionally show only the text after the given separator. Defaults
92 to the whole line if the separator is not present.
97 The font name to use. By default is set to "fixed" if compiled without
98 Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
101 The layout of the menu. The possible values are "horizontal" and
102 "vertical", with the default being "horizontal". Every other value
103 than "horizontal" is treated like "vertical", but this is kinda an
104 implementation detail and not something to be relied on, since in the
105 future other layout could be added as well.
107 A string that is rendered before the user input. Default to "$ ".
109 The width of the menu. If a numeric value is given (e.g. 400) is
110 interpreted as pixel, if it ends with a percentage symbol `%'
111 (e.g. 40%) the relative percentage will be computed (relative to the
114 The height of the menu. Like MyMenu.width if a numeric value is given
115 is interpreted as pixel, if it ends with a percentage symbol `%' the
116 relative percentage will be computed (relative to the monitor height).
118 The X coordinate of the topmost left corner of the window. Much like
119 MyMenu.height and MyMenu.width both a pixel dimension and percentage
120 could be supplied. In addition to it, some special value can be used.
125 Compute the correct value to make sure that mymenu will be
126 horizontally centered;
128 Compute the correct value to make sure that mymenu will be right
132 The Y coordinate of the topmost left corner of the window. Like the X
133 coordinate a pixel dimension, percentage dimension or the special
134 value "start", "middle", "end" could be supplied.
136 Change the padding. In the horizontal layout the padding is the space
137 between the rectangle of the completion and the text as well as the
138 space between the prompt and the first completion. In the horizontal
139 layout the padding is the horizontal spacing between the window edge
140 and the text as well as the space up and down the text within the
141 completion. The default value is 10.
142 .It MyMenu.border.size
143 A list of number separated by spaces to specify the border of the
144 window. The field is parsed like some CSS properties (i.e. padding),
145 that is: if only one value is provided then it'll be used for all
146 borders; if two value are given than the first will be used for the
147 top and bottom border and the former for the left and right border;
148 with three value the first is used for the top border, the second for
149 the left and right border and the third for the bottom border. If four
150 value are given, they'll be applied to the respective border
151 clockwise. Other values will be ignored. The default value is 0.
152 .It MyMenu.border.color
153 A list of colors for the borders. This field is parsed like the
154 MyMenu.border.size. The default value is black.
155 .It MyMenu.prompt.background
156 The background of the prompt.
157 .It MyMenu.prompt.foreground
158 The text color (foreground) of the prompt.
159 .It MyMenu.completion.background
160 The background of the completions.
161 .It MyMenu.completion.foreground
162 The text color of the completions.
163 .It MyMenu.completion_highlighted.background
164 The background of the selected completion.
165 .It MyMenu.completion_highlighted.foreground
166 The foreground of the selected completion.
170 This is the list of keybinding recognized by
172 In the following examples, C-c means Control-c.
173 .Bl -tag -width indent-two
175 Close the menu without selecting any entry
179 Close the menu and print to stdout what the user typed
183 Expand the prompt to the next possible completion
185 Expand the prompt to the previous possible completion
189 The same as Shift-Tab
191 Delete the last character
193 The same as Backspace
197 Delete the whole line
199 Toggle the ``first selected'' style. Sometimes, especially with the -a
200 option, could be handy to disable that behaviour. Let's say that
201 you've typed ``fire'' and the first completion is ``firefox'' but you
202 really want to choose ``fire''. While you can type some spaces, this
203 keybinding is a more elegant way to change, at runtime, the behaviour
204 of the first completion.
208 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
209 if used with wrong flags and EX_UNAVAILABLE if the connection to X
214 Create a simple menu with a couple of entry
215 .Bd -literal -offset indent
216 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
225 Select and play a song from the current mpd playlist
226 .Bd -literal -offset indent
227 filter="%position%) %artist% - %title%"
228 if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
229 mpc play $(echo $song | sed "s/).*$//")
239 .An Omar Polo <omar.polo@europecom.net>
244 If, instead of a numeric value, a not-valid number that terminates
245 with the % sign is supplied, then the default value for that field
246 will be treated as a percentage. Since this is a misuse of the
247 resources this behavior isn't strictly considered a bug.
249 Keep in mind that sometimes the order of the options matter. First are
250 parsed (if any) the xrdb options, then the command line flags
251 .Sy in the provided order!
252 That meas that if you're providing first the x coordinate, let's say
255 you are overriding the width, the window
259 As a general rule of thumb, if you're overriding the width and/or the
260 height of the window, remember to override the x and y coordinates as