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 Print a small usage message to stderr.
46 Print version and exit.
48 The first completion (if any) is always selected. This is like dmenu.
50 The user must chose one of the option (or none) and is not able to
55 Override the positioning on the X axis, parsed as the resource MyMenu.x
57 Override the positioning on the Y axis, parsed as the resource MyMenu.y
59 Override the padding. See the MyMenu.padding resource.
61 Override the layout. Parsed as MyMenu.layout.
63 Override the font. See MyMenu.font.
65 Override the width. Parsed as MyMenu.width.
67 Override the height. Parsed as MyMenu.height.
69 Override the borders size. Parsed as MyMenu.border.size.
71 Override the borders color. Parsed as MyMenu.border.color.
73 Override the prompt foreground color. See MyMenu.prompt.foreground.
75 Override the prompt background color. See MyMenu.prompt.background.
77 Override the completion foreground color. See
78 MyMenu.completion.foreground.
80 Override the completion background color. See
81 MyMenu.completion.background.
83 Override the highlighted completion foreground color. See
84 MyMenu.completion_highlighted.foreground.
86 Override the highlighted completion background color. See
87 MyMenu.completion_highlighted.background.
89 Embed into the given window id.
91 Show to the user only the text after the specified separator. If a
92 line does not contain the given separator, the whole line will be
98 The font name to use. By default is set to "fixed" if compiled without
99 Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
102 The layout of the menu. The possible values are "horizontal" and
103 "vertical", with the default being "horizontal". Every other value
104 than "horizontal" is treated like "vertical", but this is kinda an
105 implementation detail and not something to be relied on, since in the
106 future other layout could be added as well.
108 A string that is rendered before the user input. Default to "$ ".
110 The width of the menu. If a numeric value is given (e.g. 400) is
111 interpreted as pixel, if it ends with a percentage symbol `%'
112 (e.g. 40%) the relative percentage will be computed (relative to the
115 The height of the menu. Like MyMenu.width if a numeric value is given
116 is interpreted as pixel, if it ends with a percentage symbol `%' the
117 relative percentage will be computed (relative to the monitor height).
119 The X coordinate of the topmost left corner of the window. Much like
120 MyMenu.height and MyMenu.width both a pixel dimension and percentage
121 could be supplied. In addition to it, some special value can be used.
126 Compute the correct value to make sure that mymenu will be
127 horizontally centered;
129 Compute the correct value to make sure that mymenu will be right
133 The Y coordinate of the topmost left corner of the window. Like the X
134 coordinate a pixel dimension, percentage dimension or the special
135 value "start", "middle", "end" could be supplied.
137 Change the padding. In the horizontal layout the padding is the space
138 between the rectangle of the completion and the text as well as the
139 space between the prompt and the first completion. In the horizontal
140 layout the padding is the horizontal spacing between the window edge
141 and the text as well as the space up and down the text within the
142 completion. The default value is 10.
143 .It MyMenu.border.size
144 A list of number separated by spaces to specify the border of the
145 window. The field is parsed like some CSS properties (i.e. padding),
146 that is: if only one value is provided then it'll be used for all
147 borders; if two value are given than the first will be used for the
148 top and bottom border and the former for the left and right border;
149 with three value the first is used for the top border, the second for
150 the left and right border and the third for the bottom border. If four
151 value are given, they'll be applied to the respective border
152 clockwise. Other values will be ignored. The default value is 0.
153 .It MyMenu.border.color
154 A list of colors for the borders. This field is parsed like the
155 MyMenu.border.size. The default value is black.
156 .It MyMenu.prompt.background
157 The background of the prompt.
158 .It MyMenu.prompt.foreground
159 The text color (foreground) of the prompt.
160 .It MyMenu.completion.background
161 The background of the completions.
162 .It MyMenu.completion.foreground
163 The text color of the completions.
164 .It MyMenu.completion_highlighted.background
165 The background of the selected completion.
166 .It MyMenu.completion_highlighted.foreground
167 The foreground of the selected completion.
171 This is the list of keybinding recognized by
173 In the following examples, C-c means Control-c.
174 .Bl -tag -width indent-two
176 Close the menu without selecting any entry
180 Close the menu and print to stdout what the user typed
184 Expand the prompt to the next possible completion
186 Expand the prompt to the previous possible completion
190 The same as Shift-Tab
192 Delete the last character
194 The same as Backspace
198 Delete the whole line
200 Toggle the ``first selected'' style. Sometimes, especially with the -a
201 option, could be handy to disable that behaviour. Let's say that
202 you've typed ``fire'' and the first completion is ``firefox'' but you
203 really want to choose ``fire''. While you can type some spaces, this
204 keybinding is a more elegant way to change, at runtime, the behaviour
205 of the first completion.
209 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
210 if used with wrong flags and EX_UNAVAILABLE if the connection to X
215 Create a simple menu with a couple of entry
216 .Bd -literal -offset indent
217 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
226 Select and play a song from the current mpd playlist
227 .Bd -literal -offset indent
228 filter="%position%) %artist% - %title%"
229 if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
230 mpc play $(echo $song | sed "s/).*$//")
240 .An Omar Polo <omar.polo@europecom.net>
245 If, instead of a numeric value, a not-valid number that terminates
246 with the % sign is supplied, then the default value for that field
247 will be treated as a percentage. Since this is a misuse of the
248 resources this behavior isn't strictly considered a bug.
250 Keep in mind that sometimes the order of the options matter. First are
251 parsed (if any) the xrdb options, then the command line flags
252 .Sy in the provided order!
253 That meas that if you're providing first the x coordinate, let's say
256 you are overriding the width, the window
260 As a general rule of thumb, if you're overriding the width and/or the
261 height of the window, remember to override the x and y coordinates as