Blob


1 MYMENU(1) - General Commands Manual
3 # NAME
5 **mymenu** - simple menu for XOrg
7 # SYNOPSIS
9 **mymenu**
10 \[**-hvaA**]
11 \[**-p** *prompt*]
12 \[**-x** *coord*]
13 \[**-y** *coord*]
14 \[**-W** *width*]
15 \[**-H** *height*]
16 \[**-P** *padding*]
17 \[**-l** *layout*]
18 \[**-f** *font*]
19 \[**-b** *borders*]
20 \[**-B** *colors*]
21 \[**-t** *color*]
22 \[**-T** *color*]
23 \[**-c** *color*]
24 \[**-C** *color*]
25 \[**-s** *color*]
26 \[**-S** *color*]
27 \[**-w** *window*]
28 \[**-d** *separator*]
30 # DESCRIPTION
32 The
33 **mymenu**
34 utility a simple graphical menu for XOrg. It read the items from
35 **stdin**
36 and print the user selection to
37 **stdout**
38 on exit.
40 The following options are available and take the maximum precedence
41 over the (respective) ones defined in the
42 **X Resource Database**
44 **-h**
46 > Print a small usage message to stderr.
48 **-v**
50 > Print version and exit.
52 **-a**
54 > The first completion (if any) is always selected. This is like dmenu.
56 **-A**
58 > The user must chose one of the option (or none) and is not able to
59 > arbitrary enter text
61 **-p** *prompt*
63 > Override the prompt
65 **-x** *val*
67 > Override the positioning on the X axis, parsed as the resource MyMenu.x
69 **-y** *val*
71 > Override the positioning on the Y axis, parsed as the resource MyMenu.y
73 **-P** *padding*
75 > Override the padding. See the MyMenu.padding resource.
77 **-l** *layout*
79 > Override the layout. Parsed as MyMenu.layout.
81 **-f** *font*
83 > Override the font. See MyMenu.font.
85 **-w** *val*
87 > Override the width. Parsed as MyMenu.width.
89 **-h** *val*
91 > Override the height. Parsed as MyMenu.height.
93 **-b** *borders*
95 > Override the borders size. Parsed as MyMenu.border.size.
97 **-B** *colors*
99 > Override the borders color. Parsed as MyMenu.border.color.
101 **-t** *color*
103 > Override the prompt foreground color. See MyMenu.prompt.foreground.
105 **-T** *color*
107 > Override the prompt background color. See MyMenu.prompt.background.
109 **-c** *color*
111 > Override the completion foreground color. See
112 > MyMenu.completion.foreground.
114 **-C** *color*
116 > Override the completion background color. See
117 > MyMenu.completion.background.
119 **-s** *color*
121 > Override the highlighted completion foreground color. See
122 > MyMenu.completion\_highlighted.foreground.
124 **-S** *color*
126 > Override the highlighted completion background color. See
127 > MyMenu.completion\_highlighted.background.
129 **-w** *window*
131 > Embed into the given window id.
133 **-d** *sep*
135 > Show to the user only the text after the specified separator. If a
136 > line does not contain the given separator, the whole line will be
137 > showed to the user.
139 # RESOURCES
141 MyMenu.font
143 > The font name to use. By default is set to "fixed" if compiled without
144 > Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
145 > are supported.
147 MyMenu.layout
149 > The layout of the menu. The possible values are "horizontal" and
150 > "vertical", with the default being "horizontal". Every other value
151 > than "horizontal" is treated like "vertical", but this is kinda an
152 > implementation detail and not something to be relied on, since in the
153 > future other layout could be added as well.
155 Mymenu.prompt
157 > A string that is rendered before the user input. Default to "$ ".
159 MyMenu.width
161 > The width of the menu. If a numeric value is given (e.g. 400) is
162 > interpreted as pixel, if it ends with a percentage symbol \`%'
163 > (e.g. 40%) the relative percentage will be computed (relative to the
164 > monitor width).
166 MyMenu.height
168 > The height of the menu. Like MyMenu.width if a numeric value is given
169 > is interpreted as pixel, if it ends with a percentage symbol \`%' the
170 > relative percentage will be computed (relative to the monitor height).
172 MyMenu.x
174 > The X coordinate of the topmost left corner of the window. Much like
175 > MyMenu.height and MyMenu.width both a pixel dimension and percentage
176 > could be supplied. In addition to it, some special value can be used.
178 > start
180 > > Alias for 0;
182 > middle
184 > > Compute the correct value to make sure that mymenu will be
185 > > horizontally centered;
187 > end
189 > > Compute the correct value to make sure that mymenu will be right
190 > > aligned.
192 MyMenu.y
194 > The Y coordinate of the topmost left corner of the window. Like the X
195 > coordinate a pixel dimension, percentage dimension or the special
196 > value "start", "middle", "end" could be supplied.
198 MyMenu.padding
200 > Change the padding. In the horizontal layout the padding is the space
201 > between the rectangle of the completion and the text as well as the
202 > space between the prompt and the first completion. In the horizontal
203 > layout the padding is the horizontal spacing between the window edge
204 > and the text as well as the space up and down the text within the
205 > completion. The default value is 10.
207 MyMenu.border.size
209 > A list of number separated by spaces to specify the border of the
210 > window. The field is parsed like some CSS properties (i.e. padding),
211 > that is: if only one value is provided then it'll be used for all
212 > borders; if two value are given than the first will be used for the
213 > top and bottom border and the former for the left and right border;
214 > with three value the first is used for the top border, the second for
215 > the left and right border and the third for the bottom border. If four
216 > value are given, they'll be applied to the respective border
217 > clockwise. Other values will be ignored. The default value is 0.
219 MyMenu.border.color
221 > A list of colors for the borders. This field is parsed like the
222 > MyMenu.border.size. The default value is black.
224 MyMenu.prompt.background
226 > The background of the prompt.
228 MyMenu.prompt.foreground
230 > The text color (foreground) of the prompt.
232 MyMenu.completion.background
234 > The background of the completions.
236 MyMenu.completion.foreground
238 > The text color of the completions.
240 MyMenu.completion\_highlighted.background
242 > The background of the selected completion.
244 MyMenu.completion\_highlighted.foreground
246 > The foreground of the selected completion.
248 # KEYS
250 This is the list of keybinding recognized by
251 **mymenu**.
252 In the following examples, C-c means Control-c.
254 Esc
256 > Close the menu without selecting any entry
258 C-c
260 > The same as Esc
262 Enter
264 > Close the menu and print to stdout what the user typed
266 C-m
268 > The same as Enter
270 Tab
272 > Expand the prompt to the next possible completion
274 Shift Tab
276 > Expand the prompt to the previous possible completion
278 C-n
280 > The same as Tab
282 C-p
284 > The same as Shift-Tab
286 Backspace
288 > Delete the last character
290 C-h
292 > The same as Backspace
294 C-w
296 > Delete the last word
298 C-u
300 > Delete the whole line
302 C-i
304 > Toggle the \`\`first selected'' style. Sometimes, especially with the -a
305 > option, could be handy to disable that behaviour. Let's say that
306 > you've typed \`\`fire'' and the first completion is \`\`firefox'' but you
307 > really want to choose \`\`fire''. While you can type some spaces, this
308 > keybinding is a more elegant way to change, at runtime, the behaviour
309 > of the first completion.
311 # EXIT STATUS
313 0 when the user select an entry, 1 when the user press Esc, EX\_USAGE
314 if used with wrong flags and EX\_UNAVAILABLE if the connection to X
315 fails.
317 # EXAMPLES
319 * Create a simple menu with a couple of entry
321 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
322 firefox
323 zzz
324 xcalc -stipple
325 xlock
326 gimp
327 EOF
329 * Select and play a song from the current mpd playlist
331 filter="%position%) %artist% - %title%"
332 if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
333 mpc play $(echo $song | sed "s/).*$//")
334 fi
336 # SEE ALSO
338 dmenu(1)
339 sysexits(3)
341 # AUTHORS
343 Omar Polo &lt;omar.polo@europecom.net&gt;
345 # BUGS
347 * If, instead of a numeric value, a not-valid number that terminates
348 with the % sign is supplied, then the default value for that field
349 will be treated as a percentage. Since this is a misuse of the
350 resources this behavior isn't strictly considered a bug.
352 * Keep in mind that sometimes the order of the options matter. First are
353 parsed (if any) the xrdb options, then the command line flags
354 **in the provided order!**
355 That meas that if you're providing first the x coordinate, let's say
356 "middle", and
357 **after that**
358 you are overriding the width, the window
359 **will not be**
360 centered.
362 As a general rule of thumb, if you're overriding the width and/or the
363 height of the window, remember to override the x and y coordinates as
364 well.
366 OpenBSD 6.3 - July 21, 2018