1 0d0d65c9 2018-06-14 omar.polo MYMENU(1) - General Commands Manual
5 0d0d65c9 2018-06-14 omar.polo **mymenu** - simple menu for XOrg
7 ae801529 2018-07-13 omar.polo # SYNOPSIS
9 ae801529 2018-07-13 omar.polo **mymenu**
10 57d3c979 2018-10-17 omar.polo \[**-Aahmv**]
11 54fabaa4 2018-09-16 omar.polo \[**-B** *colors*]
12 57d3c979 2018-10-17 omar.polo \[**-b** *size*]
13 54fabaa4 2018-09-16 omar.polo \[**-C** *color*]
14 54fabaa4 2018-09-16 omar.polo \[**-c** *color*]
15 54fabaa4 2018-09-16 omar.polo \[**-d** *separator*]
16 54fabaa4 2018-09-16 omar.polo \[**-e** *window*]
17 54fabaa4 2018-09-16 omar.polo \[**-f** *font*]
18 57d3c979 2018-10-17 omar.polo \[**-G** *color*]
19 57d3c979 2018-10-17 omar.polo \[**-g** *size*]
20 844addbb 2018-07-15 omar.polo \[**-H** *height*]
21 57d3c979 2018-10-17 omar.polo \[**-I** *color*]
22 57d3c979 2018-10-17 omar.polo \[**-i** *size*]
23 57d3c979 2018-10-17 omar.polo \[**-J** *color*]
24 57d3c979 2018-10-17 omar.polo \[**-j** *size*]
25 ae801529 2018-07-13 omar.polo \[**-l** *layout*]
26 54fabaa4 2018-09-16 omar.polo \[**-P** *padding*]
27 54fabaa4 2018-09-16 omar.polo \[**-p** *prompt*]
28 ae801529 2018-07-13 omar.polo \[**-S** *color*]
29 54fabaa4 2018-09-16 omar.polo \[**-s** *color*]
30 57d3c979 2018-10-17 omar.polo \[**-T** *color*]
31 57d3c979 2018-10-17 omar.polo \[**-t** *color*]
32 54fabaa4 2018-09-16 omar.polo \[**-W** *width*]
33 54fabaa4 2018-09-16 omar.polo \[**-x** *coord*]
34 54fabaa4 2018-09-16 omar.polo \[**-y** *coord*]
36 0d0d65c9 2018-06-14 omar.polo # DESCRIPTION
39 0d0d65c9 2018-06-14 omar.polo **mymenu**
40 0d0d65c9 2018-06-14 omar.polo utility a simple graphical menu for XOrg. It read the items from
41 0d0d65c9 2018-06-14 omar.polo **stdin**
42 0d0d65c9 2018-06-14 omar.polo and print the user selection to
43 0d0d65c9 2018-06-14 omar.polo **stdout**
44 0d0d65c9 2018-06-14 omar.polo on exit.
46 ae801529 2018-07-13 omar.polo The following options are available and take the maximum precedence
47 ae801529 2018-07-13 omar.polo over the (respective) ones defined in the
48 ae801529 2018-07-13 omar.polo **X Resource Database**
52 54fabaa4 2018-09-16 omar.polo > The user must chose one of the option (or none) and is not able to
53 54fabaa4 2018-09-16 omar.polo > arbitrary enter text
57 ae801529 2018-07-13 omar.polo > The first completion (if any) is always selected. This is like dmenu.
59 54fabaa4 2018-09-16 omar.polo **-B** *colors*
61 54fabaa4 2018-09-16 omar.polo > Override the borders color. Parsed as MyMenu.border.color.
63 54fabaa4 2018-09-16 omar.polo **-b** *borders*
65 54fabaa4 2018-09-16 omar.polo > Override the borders size. Parsed as MyMenu.border.size.
67 54fabaa4 2018-09-16 omar.polo **-C** *color*
69 54fabaa4 2018-09-16 omar.polo > Override the completion background color. See
70 54fabaa4 2018-09-16 omar.polo > MyMenu.completion.background.
72 54fabaa4 2018-09-16 omar.polo **-c** *color*
74 54fabaa4 2018-09-16 omar.polo > Override the completion foreground color. See
75 54fabaa4 2018-09-16 omar.polo > MyMenu.completion.foreground.
77 54fabaa4 2018-09-16 omar.polo **-d** *separator*
79 57d3c979 2018-10-17 omar.polo > Define a string to be used as a separator (mnemonic: delimiter). Only
80 57d3c979 2018-10-17 omar.polo > the text after the separator will be rendered, but the original string
81 57d3c979 2018-10-17 omar.polo > will be returned. Useful to embed custom data on every entry. See the
82 57d3c979 2018-10-17 omar.polo > mpd example for hints on how this can be useful.
84 54fabaa4 2018-09-16 omar.polo **-e** *windowid*
86 54fabaa4 2018-09-16 omar.polo > Embed into the given window id.
88 57d3c979 2018-10-17 omar.polo **-f** *font*
90 57d3c979 2018-10-17 omar.polo > Override the font. See MyMenu.font.
92 57d3c979 2018-10-17 omar.polo **-G** *color*
94 57d3c979 2018-10-17 omar.polo > Override the border colors of the prompt. See
95 57d3c979 2018-10-17 omar.polo > MyMenu.prompt.border.color.
97 57d3c979 2018-10-17 omar.polo **-g** *size*
99 57d3c979 2018-10-17 omar.polo > Override the border size of the prompt. See
100 57d3c979 2018-10-17 omar.polo > MyMenu.prompt.border.size.
102 54fabaa4 2018-09-16 omar.polo **-H** *val*
104 54fabaa4 2018-09-16 omar.polo > Override the height. Parsed as MyMenu.height.
106 54fabaa4 2018-09-16 omar.polo **-h**
108 54fabaa4 2018-09-16 omar.polo > Print a small usage message to stderr.
110 57d3c979 2018-10-17 omar.polo **-I** *color*
112 57d3c979 2018-10-17 omar.polo > Override the border colors of the completion. See
113 57d3c979 2018-10-17 omar.polo > MyMenu.completion.border.color.
115 57d3c979 2018-10-17 omar.polo **-i** *size*
117 57d3c979 2018-10-17 omar.polo > Override the border size of the completion. See
118 57d3c979 2018-10-17 omar.polo > MyMenu.completion.border.size.
120 57d3c979 2018-10-17 omar.polo **-J** *color*
122 57d3c979 2018-10-17 omar.polo > Override the border colors of the completion. See
123 57d3c979 2018-10-17 omar.polo > MyMenu.completion\_highlighted.border.color.
125 57d3c979 2018-10-17 omar.polo **-j** *size*
127 57d3c979 2018-10-17 omar.polo > Override the border size of the completion. See
128 57d3c979 2018-10-17 omar.polo > MyMenu.completion\_highlighted.border.size.
130 54fabaa4 2018-09-16 omar.polo **-l** *layout*
132 54fabaa4 2018-09-16 omar.polo > Override the layout. Parsed as MyMenu.layout.
134 54fabaa4 2018-09-16 omar.polo **-m**
136 54fabaa4 2018-09-16 omar.polo > The user can select multiple entry via C-m. Please consult
137 845963e5 2018-09-16 omar.polo > *KEYS*
138 845963e5 2018-09-16 omar.polo > for more info.
140 54fabaa4 2018-09-16 omar.polo **-P** *padding*
142 7f9e4fec 2018-10-17 omar.polo > Override the padding. See the MyMenu.prompt.padding resource.
144 54fabaa4 2018-09-16 omar.polo **-p** *prompt*
146 54fabaa4 2018-09-16 omar.polo > Override the prompt
148 54fabaa4 2018-09-16 omar.polo **-S** *color*
150 54fabaa4 2018-09-16 omar.polo > Override the highlighted completion background color. See
151 54fabaa4 2018-09-16 omar.polo > MyMenu.completion\_highlighted.background.
153 54fabaa4 2018-09-16 omar.polo **-s** *color*
155 54fabaa4 2018-09-16 omar.polo > Override the highlighted completion foreground color. See
156 54fabaa4 2018-09-16 omar.polo > MyMenu.completion\_highlighted.foreground.
158 ae801529 2018-07-13 omar.polo **-T** *color*
160 ae801529 2018-07-13 omar.polo > Override the prompt background color. See MyMenu.prompt.background.
162 54fabaa4 2018-09-16 omar.polo **-t** *color*
164 54fabaa4 2018-09-16 omar.polo > Override the prompt foreground color. See MyMenu.prompt.foreground.
166 54fabaa4 2018-09-16 omar.polo **-v**
168 54fabaa4 2018-09-16 omar.polo > Print version and exit.
170 54fabaa4 2018-09-16 omar.polo **-W** *val*
172 54fabaa4 2018-09-16 omar.polo > Override the width. Parsed as MyMenu.width.
174 54fabaa4 2018-09-16 omar.polo **-x** *val*
176 54fabaa4 2018-09-16 omar.polo > Override the positioning on the X axis, parsed as the resource MyMenu.x
178 54fabaa4 2018-09-16 omar.polo **-y** *val*
180 54fabaa4 2018-09-16 omar.polo > Override the positioning on the Y axis, parsed as the resource MyMenu.y
182 ae801529 2018-07-13 omar.polo # RESOURCES
184 0d0d65c9 2018-06-14 omar.polo MyMenu.font
186 0d0d65c9 2018-06-14 omar.polo > The font name to use. By default is set to "fixed" if compiled without
187 0d0d65c9 2018-06-14 omar.polo > Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
188 0d0d65c9 2018-06-14 omar.polo > are supported.
190 0d0d65c9 2018-06-14 omar.polo MyMenu.layout
192 0d0d65c9 2018-06-14 omar.polo > The layout of the menu. The possible values are "horizontal" and
193 0d0d65c9 2018-06-14 omar.polo > "vertical", with the default being "horizontal". Every other value
194 0d0d65c9 2018-06-14 omar.polo > than "horizontal" is treated like "vertical", but this is kinda an
195 0d0d65c9 2018-06-14 omar.polo > implementation detail and not something to be relied on, since in the
196 0d0d65c9 2018-06-14 omar.polo > future other layout could be added as well.
198 57d3c979 2018-10-17 omar.polo MyMenu.prompt
200 0d0d65c9 2018-06-14 omar.polo > A string that is rendered before the user input. Default to "$ ".
202 57d3c979 2018-10-17 omar.polo MyMenu.prompt.border.size
204 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.border.size, but affects only the prompt. Default
205 57d3c979 2018-10-17 omar.polo > to 0.
207 57d3c979 2018-10-17 omar.polo MyMenu.prompt.border.color
209 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.border.color, but affects only the prompt. Default
210 57d3c979 2018-10-17 omar.polo > to #000 (black).
212 57d3c979 2018-10-17 omar.polo MyMenu.prompt.padding
214 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.border.size. The padding is the space between the
215 57d3c979 2018-10-17 omar.polo > end of the borderd and the start of the text, in any direction (top,
216 57d3c979 2018-10-17 omar.polo > bottom, left, right). Default to 10.
218 0d0d65c9 2018-06-14 omar.polo MyMenu.width
220 0d0d65c9 2018-06-14 omar.polo > The width of the menu. If a numeric value is given (e.g. 400) is
221 0d0d65c9 2018-06-14 omar.polo > interpreted as pixel, if it ends with a percentage symbol \`%'
222 0d0d65c9 2018-06-14 omar.polo > (e.g. 40%) the relative percentage will be computed (relative to the
223 0d0d65c9 2018-06-14 omar.polo > monitor width).
225 0d0d65c9 2018-06-14 omar.polo MyMenu.height
227 0d0d65c9 2018-06-14 omar.polo > The height of the menu. Like MyMenu.width if a numeric value is given
228 0d0d65c9 2018-06-14 omar.polo > is interpreted as pixel, if it ends with a percentage symbol \`%' the
229 0d0d65c9 2018-06-14 omar.polo > relative percentage will be computed (relative to the monitor height).
231 0d0d65c9 2018-06-14 omar.polo MyMenu.x
233 0d0d65c9 2018-06-14 omar.polo > The X coordinate of the topmost left corner of the window. Much like
234 0d0d65c9 2018-06-14 omar.polo > MyMenu.height and MyMenu.width both a pixel dimension and percentage
235 ae801529 2018-07-13 omar.polo > could be supplied. In addition to it, some special value can be used.
237 ae801529 2018-07-13 omar.polo > start
239 ae801529 2018-07-13 omar.polo > > Alias for 0;
241 f4f1270d 2019-10-18 omar.polo > middle or center
243 ae801529 2018-07-13 omar.polo > > Compute the correct value to make sure that mymenu will be
244 ae801529 2018-07-13 omar.polo > > horizontally centered;
248 ae801529 2018-07-13 omar.polo > > Compute the correct value to make sure that mymenu will be right
249 ae801529 2018-07-13 omar.polo > > aligned.
251 a8ca9c6d 2019-10-20 omar.polo > mx and my
253 a8ca9c6d 2019-10-20 omar.polo > > These stands for x and y coordinate of the mouse respectively.
255 0d0d65c9 2018-06-14 omar.polo MyMenu.y
257 0d0d65c9 2018-06-14 omar.polo > The Y coordinate of the topmost left corner of the window. Like the X
258 0d0d65c9 2018-06-14 omar.polo > coordinate a pixel dimension, percentage dimension or the special
259 a8ca9c6d 2019-10-20 omar.polo > value "start", "middle"/"center", "end" or "mx"/"my" could be supplied.
261 500ca6c1 2018-07-08 omar.polo MyMenu.border.size
263 500ca6c1 2018-07-08 omar.polo > A list of number separated by spaces to specify the border of the
264 500ca6c1 2018-07-08 omar.polo > window. The field is parsed like some CSS properties (i.e. padding),
265 500ca6c1 2018-07-08 omar.polo > that is: if only one value is provided then it'll be used for all
266 500ca6c1 2018-07-08 omar.polo > borders; if two value are given than the first will be used for the
267 500ca6c1 2018-07-08 omar.polo > top and bottom border and the former for the left and right border;
268 500ca6c1 2018-07-08 omar.polo > with three value the first is used for the top border, the second for
269 500ca6c1 2018-07-08 omar.polo > the left and right border and the third for the bottom border. If four
270 500ca6c1 2018-07-08 omar.polo > value are given, they'll be applied to the respective border
271 500ca6c1 2018-07-08 omar.polo > clockwise. Other values will be ignored. The default value is 0.
273 57d3c979 2018-10-17 omar.polo > This particular option accepts a percentage (e.g. 10%) relative to the
274 4b09b4b1 2018-10-17 omar.polo > screen width.
276 500ca6c1 2018-07-08 omar.polo MyMenu.border.color
278 500ca6c1 2018-07-08 omar.polo > A list of colors for the borders. This field is parsed like the
279 500ca6c1 2018-07-08 omar.polo > MyMenu.border.size. The default value is black.
281 0d0d65c9 2018-06-14 omar.polo MyMenu.prompt.background
283 0d0d65c9 2018-06-14 omar.polo > The background of the prompt.
285 0d0d65c9 2018-06-14 omar.polo MyMenu.prompt.foreground
287 0d0d65c9 2018-06-14 omar.polo > The text color (foreground) of the prompt.
289 0d0d65c9 2018-06-14 omar.polo MyMenu.completion.background
291 0d0d65c9 2018-06-14 omar.polo > The background of the completions.
293 0d0d65c9 2018-06-14 omar.polo MyMenu.completion.foreground
295 0d0d65c9 2018-06-14 omar.polo > The text color of the completions.
297 57d3c979 2018-10-17 omar.polo MyMenu.completion.border.size
299 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.border.size, but affects only the
300 57d3c979 2018-10-17 omar.polo > completion. Default to 0.
302 57d3c979 2018-10-17 omar.polo MyMenu.completion.border.color
304 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.border.color, but affects only the
305 57d3c979 2018-10-17 omar.polo > completion. Default to #000 (black).
307 57d3c979 2018-10-17 omar.polo MyMenu.completion.padding
309 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.prompt.padding. Default to 10.
311 0d0d65c9 2018-06-14 omar.polo MyMenu.completion\_highlighted.background
313 0d0d65c9 2018-06-14 omar.polo > The background of the selected completion.
315 0d0d65c9 2018-06-14 omar.polo MyMenu.completion\_highlighted.foreground
317 0d0d65c9 2018-06-14 omar.polo > The foreground of the selected completion.
319 57d3c979 2018-10-17 omar.polo MyMenu.completion\_highlighted.border.size
321 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.border.size, but affects only the completion
322 57d3c979 2018-10-17 omar.polo > highlighted. Default to 0.
324 57d3c979 2018-10-17 omar.polo MyMenu.completion\_highlighted.border.color
326 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.border.color, but affects only the completion
327 57d3c979 2018-10-17 omar.polo > highlighted. Default to #000 (black).
329 57d3c979 2018-10-17 omar.polo MyMenu.completion\_highlighted.padding
331 57d3c979 2018-10-17 omar.polo > Parsed like MyMenu.prompt.padding. Default to 10.
333 54fabaa4 2018-09-16 omar.polo # COLORS
335 54fabaa4 2018-09-16 omar.polo MyMenu accept colors only in the form of:
337 54fabaa4 2018-09-16 omar.polo * #rgb
339 54fabaa4 2018-09-16 omar.polo * #rrggbb
341 54fabaa4 2018-09-16 omar.polo * #aarrggbb
343 54fabaa4 2018-09-16 omar.polo The opacity is assumed 0xff (no transparency) if not provided.
345 0d0d65c9 2018-06-14 omar.polo # KEYS
347 bee0837c 2018-07-01 omar.polo This is the list of keybinding recognized by
348 bee0837c 2018-07-01 omar.polo **mymenu**.
349 bee0837c 2018-07-01 omar.polo In the following examples, C-c means Control-c.
353 0d0d65c9 2018-06-14 omar.polo > Close the menu without selecting any entry
357 bee0837c 2018-07-01 omar.polo > The same as Esc
361 0d0d65c9 2018-06-14 omar.polo > Close the menu and print to stdout what the user typed
365 0dee1b65 2018-08-13 omar.polo > Confirm but keep looping (if enabled), otherwise complete only
369 0d0d65c9 2018-06-14 omar.polo > Expand the prompt to the next possible completion
371 0d0d65c9 2018-06-14 omar.polo Shift Tab
373 0d0d65c9 2018-06-14 omar.polo > Expand the prompt to the previous possible completion
377 0d0d65c9 2018-06-14 omar.polo > The same as Tab
381 0d0d65c9 2018-06-14 omar.polo > The same as Shift-Tab
383 0d0d65c9 2018-06-14 omar.polo Backspace
385 0d0d65c9 2018-06-14 omar.polo > Delete the last character
389 0d0d65c9 2018-06-14 omar.polo > The same as Backspace
393 0d0d65c9 2018-06-14 omar.polo > Delete the last word
397 0d0d65c9 2018-06-14 omar.polo > Delete the whole line
401 6254fed8 2018-07-06 omar.polo > Toggle the \`\`first selected'' style. Sometimes, especially with the -a
402 6254fed8 2018-07-06 omar.polo > option, could be handy to disable that behaviour. Let's say that
403 6254fed8 2018-07-06 omar.polo > you've typed \`\`fire'' and the first completion is \`\`firefox'' but you
404 6254fed8 2018-07-06 omar.polo > really want to choose \`\`fire''. While you can type some spaces, this
405 6254fed8 2018-07-06 omar.polo > keybinding is a more elegant way to change, at runtime, the behaviour
406 6254fed8 2018-07-06 omar.polo > of the first completion.
408 a81dbe5d 2019-10-19 omar.polo Button1
410 6fa04514 2019-10-20 omar.polo > Clicking on the prompt area closes mymenu, clicking on an item will
411 6fa04514 2019-10-20 omar.polo > confirm it.
413 a81dbe5d 2019-10-19 omar.polo Button3
415 6fa04514 2019-10-20 omar.polo > Clicking on the prompt area closes mymenu, clicking on an item will
416 6fa04514 2019-10-20 omar.polo > confirm but keep looping (if enabled) the clicked item, like C-m
418 a81dbe5d 2019-10-19 omar.polo Button4,Button5 / scroll
420 a81dbe5d 2019-10-19 omar.polo > Scroll through the completions (without changing the selection)
422 3518f203 2018-07-21 omar.polo # EXIT STATUS
424 3518f203 2018-07-21 omar.polo 0 when the user select an entry, 1 when the user press Esc, EX\_USAGE
425 3518f203 2018-07-21 omar.polo if used with wrong flags and EX\_UNAVAILABLE if the connection to X
426 3518f203 2018-07-21 omar.polo fails.
428 3518f203 2018-07-21 omar.polo # EXAMPLES
430 3518f203 2018-07-21 omar.polo * Create a simple menu with a couple of entry
432 3518f203 2018-07-21 omar.polo cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
433 3518f203 2018-07-21 omar.polo firefox
435 3518f203 2018-07-21 omar.polo xcalc -stipple
440 3518f203 2018-07-21 omar.polo * Select and play a song from the current mpd playlist
442 630eb368 2018-09-19 omar.polo fmt="%position% %artist% - %title%"
443 630eb368 2018-09-19 omar.polo if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
444 630eb368 2018-09-19 omar.polo mpc play $(echo $song | sed "s/ .*$//")
447 3518f203 2018-07-21 omar.polo # SEE ALSO
449 3518f203 2018-07-21 omar.polo dmenu(1)
450 3518f203 2018-07-21 omar.polo sysexits(3)
452 3518f203 2018-07-21 omar.polo # AUTHORS
454 3518f203 2018-07-21 omar.polo Omar Polo <omar.polo@europecom.net>
456 0dee1b65 2018-08-13 omar.polo # CAVEATS
458 0d0d65c9 2018-06-14 omar.polo * If, instead of a numeric value, a not-valid number that terminates
459 0d0d65c9 2018-06-14 omar.polo with the % sign is supplied, then the default value for that field
460 0d0d65c9 2018-06-14 omar.polo will be treated as a percentage. Since this is a misuse of the
461 0d0d65c9 2018-06-14 omar.polo resources this behavior isn't strictly considered a bug.
463 ae801529 2018-07-13 omar.polo * Keep in mind that sometimes the order of the options matter. First are
464 ae801529 2018-07-13 omar.polo parsed (if any) the xrdb options, then the command line flags
465 ae801529 2018-07-13 omar.polo **in the provided order!**
466 ae801529 2018-07-13 omar.polo That meas that if you're providing first the x coordinate, let's say
467 ae801529 2018-07-13 omar.polo "middle", and
468 ae801529 2018-07-13 omar.polo **after that**
469 ae801529 2018-07-13 omar.polo you are overriding the width, the window
470 ae801529 2018-07-13 omar.polo **will not be**
471 ae801529 2018-07-13 omar.polo centered.
473 ae801529 2018-07-13 omar.polo As a general rule of thumb, if you're overriding the width and/or the
474 ae801529 2018-07-13 omar.polo height of the window, remember to override the x and y coordinates as
477 a8ca9c6d 2019-10-20 omar.polo * Clicking past the last item will be equivalent to clicking the last item.
479 a8ca9c6d 2019-10-20 omar.polo Void Linux - October 20, 2019