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 The user must chose one of the option (or none) and is not able to
47 The first completion (if any) is always selected. This is like dmenu.
49 Override the borders color. Parsed as MyMenu.border.color.
51 Override the borders size. Parsed as MyMenu.border.size.
53 Override the completion background color. See
54 MyMenu.completion.background.
56 Override the completion foreground color. See
57 MyMenu.completion.foreground.
59 Define a string to be used as a separator. Only the text after the
60 separator will be rendered, but the original string will be
61 returned. Useful to embed custom data on every entry. See the mpd
62 example for hints on how this can be useful.
64 Embed into the given window id.
66 Override the height. Parsed as MyMenu.height.
68 Print a small usage message to stderr.
70 Override the font. See MyMenu.font.
72 Override the layout. Parsed as MyMenu.layout.
74 The user can select multiple entry via C-m. Please consult
78 Override the padding. See the MyMenu.padding resource.
82 Override the highlighted completion background color. See
83 MyMenu.completion_highlighted.background.
85 Override the highlighted completion foreground color. See
86 MyMenu.completion_highlighted.foreground.
88 Override the prompt background color. See MyMenu.prompt.background.
90 Override the prompt foreground color. See MyMenu.prompt.foreground.
92 Print version and exit.
94 Override the width. Parsed as MyMenu.width.
96 Override the positioning on the X axis, parsed as the resource MyMenu.x
98 Override the positioning on the Y axis, parsed as the resource MyMenu.y
103 The font name to use. By default is set to "fixed" if compiled without
104 Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
107 The layout of the menu. The possible values are "horizontal" and
108 "vertical", with the default being "horizontal". Every other value
109 than "horizontal" is treated like "vertical", but this is kinda an
110 implementation detail and not something to be relied on, since in the
111 future other layout could be added as well.
113 A string that is rendered before the user input. Default to "$ ".
115 The width of the menu. If a numeric value is given (e.g. 400) is
116 interpreted as pixel, if it ends with a percentage symbol `%'
117 (e.g. 40%) the relative percentage will be computed (relative to the
120 The height of the menu. Like MyMenu.width if a numeric value is given
121 is interpreted as pixel, if it ends with a percentage symbol `%' the
122 relative percentage will be computed (relative to the monitor height).
124 The X coordinate of the topmost left corner of the window. Much like
125 MyMenu.height and MyMenu.width both a pixel dimension and percentage
126 could be supplied. In addition to it, some special value can be used.
131 Compute the correct value to make sure that mymenu will be
132 horizontally centered;
134 Compute the correct value to make sure that mymenu will be right
138 The Y coordinate of the topmost left corner of the window. Like the X
139 coordinate a pixel dimension, percentage dimension or the special
140 value "start", "middle", "end" could be supplied.
142 Change the padding. In the horizontal layout the padding is the space
143 between the rectangle of the completion and the text as well as the
144 space between the prompt and the first completion. In the horizontal
145 layout the padding is the horizontal spacing between the window edge
146 and the text as well as the space up and down the text within the
147 completion. The default value is 10.
148 .It MyMenu.border.size
149 A list of number separated by spaces to specify the border of the
150 window. The field is parsed like some CSS properties (i.e. padding),
151 that is: if only one value is provided then it'll be used for all
152 borders; if two value are given than the first will be used for the
153 top and bottom border and the former for the left and right border;
154 with three value the first is used for the top border, the second for
155 the left and right border and the third for the bottom border. If four
156 value are given, they'll be applied to the respective border
157 clockwise. Other values will be ignored. The default value is 0.
158 .It MyMenu.border.color
159 A list of colors for the borders. This field is parsed like the
160 MyMenu.border.size. The default value is black.
161 .It MyMenu.prompt.background
162 The background of the prompt.
163 .It MyMenu.prompt.foreground
164 The text color (foreground) of the prompt.
165 .It MyMenu.completion.background
166 The background of the completions.
167 .It MyMenu.completion.foreground
168 The text color of the completions.
169 .It MyMenu.completion_highlighted.background
170 The background of the selected completion.
171 .It MyMenu.completion_highlighted.foreground
172 The foreground of the selected completion.
175 MyMenu accept colors only in the form of:
185 The opacity is assumed 0xff (no transparency) if not provided.
187 This is the list of keybinding recognized by
189 In the following examples, C-c means Control-c.
190 .Bl -tag -width indent-two
192 Close the menu without selecting any entry
196 Close the menu and print to stdout what the user typed
198 Confirm but keep looping (if enabled), otherwise complete only
200 Expand the prompt to the next possible completion
202 Expand the prompt to the previous possible completion
206 The same as Shift-Tab
208 Delete the last character
210 The same as Backspace
214 Delete the whole line
216 Toggle the ``first selected'' style. Sometimes, especially with the -a
217 option, could be handy to disable that behaviour. Let's say that
218 you've typed ``fire'' and the first completion is ``firefox'' but you
219 really want to choose ``fire''. While you can type some spaces, this
220 keybinding is a more elegant way to change, at runtime, the behaviour
221 of the first completion.
224 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
225 if used with wrong flags and EX_UNAVAILABLE if the connection to X
230 Create a simple menu with a couple of entry
231 .Bd -literal -offset indent
232 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
241 Select and play a song from the current mpd playlist
242 .Bd -literal -offset indent
243 fmt="%position% %artist% - %title%"
244 if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
245 mpc play $(echo $song | sed "s/ .*$//")
255 .An Omar Polo <omar.polo@europecom.net>
260 If, instead of a numeric value, a not-valid number that terminates
261 with the % sign is supplied, then the default value for that field
262 will be treated as a percentage. Since this is a misuse of the
263 resources this behavior isn't strictly considered a bug.
265 Keep in mind that sometimes the order of the options matter. First are
266 parsed (if any) the xrdb options, then the command line flags
267 .Sy in the provided order!
268 That meas that if you're providing first the x coordinate, let's say
271 you are overriding the width, the window
275 As a general rule of thumb, if you're overriding the width and/or the
276 height of the window, remember to override the x and y coordinates as