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
171 These stands for x and y coordinate of the mouse respectively.
174 The Y coordinate of the topmost left corner of the window. Like the X
175 coordinate a pixel dimension, percentage dimension or the special
176 value "start", "middle"/"center", "end" or "mx"/"my" could be supplied.
177 .It MyMenu.border.size
178 A list of number separated by spaces to specify the border of the
179 window. The field is parsed like some CSS properties (i.e. padding),
180 that is: if only one value is provided then it'll be used for all
181 borders; if two value are given than the first will be used for the
182 top and bottom border and the former for the left and right border;
183 with three value the first is used for the top border, the second for
184 the left and right border and the third for the bottom border. If four
185 value are given, they'll be applied to the respective border
186 clockwise. Other values will be ignored. The default value is 0.
188 This particular option accepts a percentage (e.g. 10%) relative to the
190 .It MyMenu.border.color
191 A list of colors for the borders. This field is parsed like the
192 MyMenu.border.size. The default value is black.
193 .It MyMenu.prompt.background
194 The background of the prompt.
195 .It MyMenu.prompt.foreground
196 The text color (foreground) of the prompt.
197 .It MyMenu.completion.background
198 The background of the completions.
199 .It MyMenu.completion.foreground
200 The text color of the completions.
201 .It MyMenu.completion.border.size
202 Parsed like MyMenu.border.size, but affects only the
203 completion. Default to 0.
204 .It MyMenu.completion.border.color
205 Parsed like MyMenu.border.color, but affects only the
206 completion. Default to #000 (black).
207 .It MyMenu.completion.padding
208 Parsed like MyMenu.prompt.padding. Default to 10.
209 .It MyMenu.completion_highlighted.background
210 The background of the selected completion.
211 .It MyMenu.completion_highlighted.foreground
212 The foreground of the selected completion.
213 .It MyMenu.completion_highlighted.border.size
214 Parsed like MyMenu.border.size, but affects only the completion
215 highlighted. Default to 0.
216 .It MyMenu.completion_highlighted.border.color
217 Parsed like MyMenu.border.color, but affects only the completion
218 highlighted. Default to #000 (black).
219 .It MyMenu.completion_highlighted.padding
220 Parsed like MyMenu.prompt.padding. Default to 10.
223 MyMenu accept colors only in the form of:
233 The opacity is assumed 0xff (no transparency) if not provided.
235 This is the list of keybinding recognized by
237 In the following examples, C-c means Control-c.
238 .Bl -tag -width indent-two
240 Close the menu without selecting any entry
244 Close the menu and print to stdout what the user typed
246 Confirm but keep looping (if enabled), otherwise complete only
248 Expand the prompt to the next possible completion
250 Expand the prompt to the previous possible completion
254 The same as Shift-Tab
256 Delete the last character
258 The same as Backspace
262 Delete the whole line
264 Toggle the ``first selected'' style. Sometimes, especially with the -a
265 option, could be handy to disable that behaviour. Let's say that
266 you've typed ``fire'' and the first completion is ``firefox'' but you
267 really want to choose ``fire''. While you can type some spaces, this
268 keybinding is a more elegant way to change, at runtime, the behaviour
269 of the first completion.
271 Clicking on the prompt area closes mymenu, clicking on an item will
274 Clicking on the prompt area closes mymenu, clicking on an item will
275 confirm but keep looping (if enabled) the clicked item, like C-m
276 .It Button4,Button5 / scroll
277 Scroll through the completions (without changing the selection)
280 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
281 if used with wrong flags and EX_UNAVAILABLE if the connection to X
286 Create a simple menu with a couple of entry
287 .Bd -literal -offset indent
288 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
297 Select and play a song from the current mpd playlist
298 .Bd -literal -offset indent
299 fmt="%position% %artist% - %title%"
300 if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
301 mpc play $(echo $song | sed "s/ .*$//")
311 .An Omar Polo <omar.polo@europecom.net>
316 If, instead of a numeric value, a not-valid number that terminates
317 with the % sign is supplied, then the default value for that field
318 will be treated as a percentage. Since this is a misuse of the
319 resources this behavior isn't strictly considered a bug.
321 Keep in mind that sometimes the order of the options matter. First are
322 parsed (if any) the xrdb options, then the command line flags
323 .Sy in the provided order!
324 That meas that if you're providing first the x coordinate, let's say
327 you are overriding the width, the window
331 As a general rule of thumb, if you're overriding the width and/or the
332 height of the window, remember to override the x and y coordinates as
335 Clicking past the last item will be equivalent to clicking the last item.