6 .Nd simple menu for XOrg
39 utility a simple graphical menu for XOrg. It read the items from
41 and print the user selection to
45 The following options are available and take the maximum precedence
46 over the (respective) ones defined in the
47 .Sy X Resource Database
48 .Bl -tag -width indent-two
50 The user must chose one of the option (or none) and is not able to
53 The first completion (if any) is always selected. This is like dmenu.
55 Override the borders color. Parsed as MyMenu.border.color.
57 Override the borders size. Parsed as MyMenu.border.size.
59 Override the completion background color. See
60 MyMenu.completion.background.
62 Override the completion foreground color. See
63 MyMenu.completion.foreground.
65 Define a string to be used as a separator (mnemonic: delimiter). Only
66 the text after the separator will be rendered, but the original string
67 will be returned. Useful to embed custom data on every entry. See the
68 mpd example for hints on how this can be useful.
70 Embed into the given window id.
72 Override the font. See MyMenu.font.
74 Override the border colors of the prompt. See
75 MyMenu.prompt.border.color.
77 Override the border size of the prompt. See
78 MyMenu.prompt.border.size.
80 Override the height. Parsed as MyMenu.height.
82 Print a small usage message to stderr.
84 Override the border colors of the completion. See
85 MyMenu.completion.border.color.
87 Override the border size of the completion. See
88 MyMenu.completion.border.size.
90 Override the border colors of the completion. See
91 MyMenu.completion_highlighted.border.color.
93 Override the border size of the completion. See
94 MyMenu.completion_highlighted.border.size.
96 Override the layout. Parsed as MyMenu.layout.
98 The user can select multiple entry via C-m. Please consult
102 Override the padding. See the MyMenu.prompt.padding resource.
106 Override the highlighted completion background color. See
107 MyMenu.completion_highlighted.background.
109 Override the highlighted completion foreground color. See
110 MyMenu.completion_highlighted.foreground.
112 Override the prompt background color. See MyMenu.prompt.background.
114 Override the prompt foreground color. See MyMenu.prompt.foreground.
116 Print version and exit.
118 Override the width. Parsed as MyMenu.width.
120 Override the positioning on the X axis, parsed as the resource MyMenu.x
122 Override the positioning on the Y axis, parsed as the resource MyMenu.y
127 The font name to use. By default is set to "fixed" if compiled without
128 Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
131 The layout of the menu. The possible values are "horizontal" and
132 "vertical", with the default being "horizontal". Every other value
133 than "horizontal" is treated like "vertical", but this is kinda an
134 implementation detail and not something to be relied on, since in the
135 future other layout could be added as well.
137 A string that is rendered before the user input. Default to "$ ".
138 .It MyMenu.prompt.border.size
139 Parsed like MyMenu.border.size, but affects only the prompt. Default
141 .It MyMenu.prompt.border.color
142 Parsed like MyMenu.border.color, but affects only the prompt. Default
144 .It MyMenu.prompt.padding
145 Parsed like MyMenu.border.size. The padding is the space between the
146 end of the borderd and the start of the text, in any direction (top,
147 bottom, left, right). Default to 10.
149 The width of the menu. If a numeric value is given (e.g. 400) is
150 interpreted as pixel, if it ends with a percentage symbol `%'
151 (e.g. 40%) the relative percentage will be computed (relative to the
154 The height of the menu. Like MyMenu.width if a numeric value is given
155 is interpreted as pixel, if it ends with a percentage symbol `%' the
156 relative percentage will be computed (relative to the monitor height).
158 The X coordinate of the topmost left corner of the window. Much like
159 MyMenu.height and MyMenu.width both a pixel dimension and percentage
160 could be supplied. In addition to it, some special value can be used.
165 Compute the correct value to make sure that mymenu will be
166 horizontally centered;
168 Compute the correct value to make sure that mymenu will be right
172 The Y coordinate of the topmost left corner of the window. Like the X
173 coordinate a pixel dimension, percentage dimension or the special
174 value "start", "middle", "end" could be supplied.
175 .It MyMenu.border.size
176 A list of number separated by spaces to specify the border of the
177 window. The field is parsed like some CSS properties (i.e. padding),
178 that is: if only one value is provided then it'll be used for all
179 borders; if two value are given than the first will be used for the
180 top and bottom border and the former for the left and right border;
181 with three value the first is used for the top border, the second for
182 the left and right border and the third for the bottom border. If four
183 value are given, they'll be applied to the respective border
184 clockwise. Other values will be ignored. The default value is 0.
186 This particular option accepts a percentage (e.g. 10%) relative to the
188 .It MyMenu.border.color
189 A list of colors for the borders. This field is parsed like the
190 MyMenu.border.size. The default value is black.
191 .It MyMenu.prompt.background
192 The background of the prompt.
193 .It MyMenu.prompt.foreground
194 The text color (foreground) of the prompt.
195 .It MyMenu.completion.background
196 The background of the completions.
197 .It MyMenu.completion.foreground
198 The text color of the completions.
199 .It MyMenu.completion.border.size
200 Parsed like MyMenu.border.size, but affects only the
201 completion. Default to 0.
202 .It MyMenu.completion.border.color
203 Parsed like MyMenu.border.color, but affects only the
204 completion. Default to #000 (black).
205 .It MyMenu.completion.padding
206 Parsed like MyMenu.prompt.padding. Default to 10.
207 .It MyMenu.completion_highlighted.background
208 The background of the selected completion.
209 .It MyMenu.completion_highlighted.foreground
210 The foreground of the selected completion.
211 .It MyMenu.completion_highlighted.border.size
212 Parsed like MyMenu.border.size, but affects only the completion
213 highlighted. Default to 0.
214 .It MyMenu.completion_highlighted.border.color
215 Parsed like MyMenu.border.color, but affects only the completion
216 highlighted. Default to #000 (black).
217 .It MyMenu.completion_highlighted.padding
218 Parsed like MyMenu.prompt.padding. Default to 10.
221 MyMenu accept colors only in the form of:
231 The opacity is assumed 0xff (no transparency) if not provided.
233 This is the list of keybinding recognized by
235 In the following examples, C-c means Control-c.
236 .Bl -tag -width indent-two
238 Close the menu without selecting any entry
242 Close the menu and print to stdout what the user typed
244 Confirm but keep looping (if enabled), otherwise complete only
246 Expand the prompt to the next possible completion
248 Expand the prompt to the previous possible completion
252 The same as Shift-Tab
254 Delete the last character
256 The same as Backspace
260 Delete the whole line
262 Toggle the ``first selected'' style. Sometimes, especially with the -a
263 option, could be handy to disable that behaviour. Let's say that
264 you've typed ``fire'' and the first completion is ``firefox'' but you
265 really want to choose ``fire''. While you can type some spaces, this
266 keybinding is a more elegant way to change, at runtime, the behaviour
267 of the first completion.
270 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
271 if used with wrong flags and EX_UNAVAILABLE if the connection to X
276 Create a simple menu with a couple of entry
277 .Bd -literal -offset indent
278 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
287 Select and play a song from the current mpd playlist
288 .Bd -literal -offset indent
289 fmt="%position% %artist% - %title%"
290 if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
291 mpc play $(echo $song | sed "s/ .*$//")
301 .An Omar Polo <omar.polo@europecom.net>
306 If, instead of a numeric value, a not-valid number that terminates
307 with the % sign is supplied, then the default value for that field
308 will be treated as a percentage. Since this is a misuse of the
309 resources this behavior isn't strictly considered a bug.
311 Keep in mind that sometimes the order of the options matter. First are
312 parsed (if any) the xrdb options, then the command line flags
313 .Sy in the provided order!
314 That meas that if you're providing first the x coordinate, let's say
317 you are overriding the width, the window
321 As a general rule of thumb, if you're overriding the width and/or the
322 height of the window, remember to override the x and y coordinates as