Blob


1 MYMENU(1) - General Commands Manual
3 # NAME
5 **mymenu** - simple menu for XOrg
7 # SYNOPSIS
9 **mymenu**
10 \[**-Aamvh**]
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 \[**-e** *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 **-m**
63 > The user can select multiple entry via C-m. Please consult
64 > *KEYS*
65 > for more info.
67 **-p** *prompt*
69 > Override the prompt
71 **-x** *val*
73 > Override the positioning on the X axis, parsed as the resource MyMenu.x
75 **-y** *val*
77 > Override the positioning on the Y axis, parsed as the resource MyMenu.y
79 **-P** *padding*
81 > Override the padding. See the MyMenu.padding resource.
83 **-l** *layout*
85 > Override the layout. Parsed as MyMenu.layout.
87 **-f** *font*
89 > Override the font. See MyMenu.font.
91 **-w** *val*
93 > Override the width. Parsed as MyMenu.width.
95 **-h** *val*
97 > Override the height. Parsed as MyMenu.height.
99 **-b** *borders*
101 > Override the borders size. Parsed as MyMenu.border.size.
103 **-B** *colors*
105 > Override the borders color. Parsed as MyMenu.border.color.
107 **-t** *color*
109 > Override the prompt foreground color. See MyMenu.prompt.foreground.
111 **-T** *color*
113 > Override the prompt background color. See MyMenu.prompt.background.
115 **-c** *color*
117 > Override the completion foreground color. See
118 > MyMenu.completion.foreground.
120 **-C** *color*
122 > Override the completion background color. See
123 > MyMenu.completion.background.
125 **-s** *color*
127 > Override the highlighted completion foreground color. See
128 > MyMenu.completion\_highlighted.foreground.
130 **-S** *color*
132 > Override the highlighted completion background color. See
133 > MyMenu.completion\_highlighted.background.
135 **-w** *window*
137 > Embed into the given window id.
139 **-d** *sep*
141 > Optionally show only the text after the given separator. Defaults
142 > to the whole line if the separator is not present.
144 # RESOURCES
146 MyMenu.font
148 > The font name to use. By default is set to "fixed" if compiled without
149 > Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
150 > are supported.
152 MyMenu.layout
154 > The layout of the menu. The possible values are "horizontal" and
155 > "vertical", with the default being "horizontal". Every other value
156 > than "horizontal" is treated like "vertical", but this is kinda an
157 > implementation detail and not something to be relied on, since in the
158 > future other layout could be added as well.
160 Mymenu.prompt
162 > A string that is rendered before the user input. Default to "$ ".
164 MyMenu.width
166 > The width of the menu. If a numeric value is given (e.g. 400) is
167 > interpreted as pixel, if it ends with a percentage symbol \`%'
168 > (e.g. 40%) the relative percentage will be computed (relative to the
169 > monitor width).
171 MyMenu.height
173 > The height of the menu. Like MyMenu.width if a numeric value is given
174 > is interpreted as pixel, if it ends with a percentage symbol \`%' the
175 > relative percentage will be computed (relative to the monitor height).
177 MyMenu.x
179 > The X coordinate of the topmost left corner of the window. Much like
180 > MyMenu.height and MyMenu.width both a pixel dimension and percentage
181 > could be supplied. In addition to it, some special value can be used.
183 > start
185 > > Alias for 0;
187 > middle
189 > > Compute the correct value to make sure that mymenu will be
190 > > horizontally centered;
192 > end
194 > > Compute the correct value to make sure that mymenu will be right
195 > > aligned.
197 MyMenu.y
199 > The Y coordinate of the topmost left corner of the window. Like the X
200 > coordinate a pixel dimension, percentage dimension or the special
201 > value "start", "middle", "end" could be supplied.
203 MyMenu.padding
205 > Change the padding. In the horizontal layout the padding is the space
206 > between the rectangle of the completion and the text as well as the
207 > space between the prompt and the first completion. In the horizontal
208 > layout the padding is the horizontal spacing between the window edge
209 > and the text as well as the space up and down the text within the
210 > completion. The default value is 10.
212 MyMenu.border.size
214 > A list of number separated by spaces to specify the border of the
215 > window. The field is parsed like some CSS properties (i.e. padding),
216 > that is: if only one value is provided then it'll be used for all
217 > borders; if two value are given than the first will be used for the
218 > top and bottom border and the former for the left and right border;
219 > with three value the first is used for the top border, the second for
220 > the left and right border and the third for the bottom border. If four
221 > value are given, they'll be applied to the respective border
222 > clockwise. Other values will be ignored. The default value is 0.
224 MyMenu.border.color
226 > A list of colors for the borders. This field is parsed like the
227 > MyMenu.border.size. The default value is black.
229 MyMenu.prompt.background
231 > The background of the prompt.
233 MyMenu.prompt.foreground
235 > The text color (foreground) of the prompt.
237 MyMenu.completion.background
239 > The background of the completions.
241 MyMenu.completion.foreground
243 > The text color of the completions.
245 MyMenu.completion\_highlighted.background
247 > The background of the selected completion.
249 MyMenu.completion\_highlighted.foreground
251 > The foreground of the selected completion.
253 # KEYS
255 This is the list of keybinding recognized by
256 **mymenu**.
257 In the following examples, C-c means Control-c.
259 Esc
261 > Close the menu without selecting any entry
263 C-c
265 > The same as Esc
267 Enter
269 > Close the menu and print to stdout what the user typed
271 C-m
273 > Confirm but keep looping (if enabled), otherwise complete only
275 Tab
277 > Expand the prompt to the next possible completion
279 Shift Tab
281 > Expand the prompt to the previous possible completion
283 C-n
285 > The same as Tab
287 C-p
289 > The same as Shift-Tab
291 Backspace
293 > Delete the last character
295 C-h
297 > The same as Backspace
299 C-w
301 > Delete the last word
303 C-u
305 > Delete the whole line
307 C-i
309 > Toggle the \`\`first selected'' style. Sometimes, especially with the -a
310 > option, could be handy to disable that behaviour. Let's say that
311 > you've typed \`\`fire'' and the first completion is \`\`firefox'' but you
312 > really want to choose \`\`fire''. While you can type some spaces, this
313 > keybinding is a more elegant way to change, at runtime, the behaviour
314 > of the first completion.
316 # EXIT STATUS
318 0 when the user select an entry, 1 when the user press Esc, EX\_USAGE
319 if used with wrong flags and EX\_UNAVAILABLE if the connection to X
320 fails.
322 # EXAMPLES
324 * Create a simple menu with a couple of entry
326 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
327 firefox
328 zzz
329 xcalc -stipple
330 xlock
331 gimp
332 EOF
334 * Select and play a song from the current mpd playlist
336 filter="%position%) %artist% - %title%"
337 if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
338 mpc play $(echo $song | sed "s/).*$//")
339 fi
341 # SEE ALSO
343 dmenu(1)
344 sysexits(3)
346 # AUTHORS
348 Omar Polo &lt;omar.polo@europecom.net&gt;
350 # CAVEATS
352 * If, instead of a numeric value, a not-valid number that terminates
353 with the % sign is supplied, then the default value for that field
354 will be treated as a percentage. Since this is a misuse of the
355 resources this behavior isn't strictly considered a bug.
357 * Keep in mind that sometimes the order of the options matter. First are
358 parsed (if any) the xrdb options, then the command line flags
359 **in the provided order!**
360 That meas that if you're providing first the x coordinate, let's say
361 "middle", and
362 **after that**
363 you are overriding the width, the window
364 **will not be**
365 centered.
367 As a general rule of thumb, if you're overriding the width and/or the
368 height of the window, remember to override the x and y coordinates as
369 well.
371 OpenBSD 6.3 - August 13, 2018