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
53 The user can select multiple entry via C-m. Please consult
59 Override the positioning on the X axis, parsed as the resource MyMenu.x
61 Override the positioning on the Y axis, parsed as the resource MyMenu.y
63 Override the padding. See the MyMenu.padding resource.
65 Override the layout. Parsed as MyMenu.layout.
67 Override the font. See MyMenu.font.
69 Override the width. Parsed as MyMenu.width.
71 Override the height. Parsed as MyMenu.height.
73 Override the borders size. Parsed as MyMenu.border.size.
75 Override the borders color. Parsed as MyMenu.border.color.
77 Override the prompt foreground color. See MyMenu.prompt.foreground.
79 Override the prompt background color. See MyMenu.prompt.background.
81 Override the completion foreground color. See
82 MyMenu.completion.foreground.
84 Override the completion background color. See
85 MyMenu.completion.background.
87 Override the highlighted completion foreground color. See
88 MyMenu.completion_highlighted.foreground.
90 Override the highlighted completion background color. See
91 MyMenu.completion_highlighted.background.
93 Embed into the given window id.
95 Optionally show only the text after the given separator. Defaults
96 to the whole line if the separator is not present.
101 The font name to use. By default is set to "fixed" if compiled without
102 Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
105 The layout of the menu. The possible values are "horizontal" and
106 "vertical", with the default being "horizontal". Every other value
107 than "horizontal" is treated like "vertical", but this is kinda an
108 implementation detail and not something to be relied on, since in the
109 future other layout could be added as well.
111 A string that is rendered before the user input. Default to "$ ".
113 The width of the menu. If a numeric value is given (e.g. 400) is
114 interpreted as pixel, if it ends with a percentage symbol `%'
115 (e.g. 40%) the relative percentage will be computed (relative to the
118 The height of the menu. Like MyMenu.width if a numeric value is given
119 is interpreted as pixel, if it ends with a percentage symbol `%' the
120 relative percentage will be computed (relative to the monitor height).
122 The X coordinate of the topmost left corner of the window. Much like
123 MyMenu.height and MyMenu.width both a pixel dimension and percentage
124 could be supplied. In addition to it, some special value can be used.
129 Compute the correct value to make sure that mymenu will be
130 horizontally centered;
132 Compute the correct value to make sure that mymenu will be right
136 The Y coordinate of the topmost left corner of the window. Like the X
137 coordinate a pixel dimension, percentage dimension or the special
138 value "start", "middle", "end" could be supplied.
140 Change the padding. In the horizontal layout the padding is the space
141 between the rectangle of the completion and the text as well as the
142 space between the prompt and the first completion. In the horizontal
143 layout the padding is the horizontal spacing between the window edge
144 and the text as well as the space up and down the text within the
145 completion. The default value is 10.
146 .It MyMenu.border.size
147 A list of number separated by spaces to specify the border of the
148 window. The field is parsed like some CSS properties (i.e. padding),
149 that is: if only one value is provided then it'll be used for all
150 borders; if two value are given than the first will be used for the
151 top and bottom border and the former for the left and right border;
152 with three value the first is used for the top border, the second for
153 the left and right border and the third for the bottom border. If four
154 value are given, they'll be applied to the respective border
155 clockwise. Other values will be ignored. The default value is 0.
156 .It MyMenu.border.color
157 A list of colors for the borders. This field is parsed like the
158 MyMenu.border.size. The default value is black.
159 .It MyMenu.prompt.background
160 The background of the prompt.
161 .It MyMenu.prompt.foreground
162 The text color (foreground) of the prompt.
163 .It MyMenu.completion.background
164 The background of the completions.
165 .It MyMenu.completion.foreground
166 The text color of the completions.
167 .It MyMenu.completion_highlighted.background
168 The background of the selected completion.
169 .It MyMenu.completion_highlighted.foreground
170 The foreground of the selected completion.
174 This is the list of keybinding recognized by
176 In the following examples, C-c means Control-c.
177 .Bl -tag -width indent-two
179 Close the menu without selecting any entry
183 Close the menu and print to stdout what the user typed
185 Confirm but keep looping (if enabled), otherwise complete only
187 Expand the prompt to the next possible completion
189 Expand the prompt to the previous possible completion
193 The same as Shift-Tab
195 Delete the last character
197 The same as Backspace
201 Delete the whole line
203 Toggle the ``first selected'' style. Sometimes, especially with the -a
204 option, could be handy to disable that behaviour. Let's say that
205 you've typed ``fire'' and the first completion is ``firefox'' but you
206 really want to choose ``fire''. While you can type some spaces, this
207 keybinding is a more elegant way to change, at runtime, the behaviour
208 of the first completion.
212 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
213 if used with wrong flags and EX_UNAVAILABLE if the connection to X
218 Create a simple menu with a couple of entry
219 .Bd -literal -offset indent
220 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
229 Select and play a song from the current mpd playlist
230 .Bd -literal -offset indent
231 filter="%position%) %artist% - %title%"
232 if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
233 mpc play $(echo $song | sed "s/).*$//")
243 .An Omar Polo <omar.polo@europecom.net>
248 If, instead of a numeric value, a not-valid number that terminates
249 with the % sign is supplied, then the default value for that field
250 will be treated as a percentage. Since this is a misuse of the
251 resources this behavior isn't strictly considered a bug.
253 Keep in mind that sometimes the order of the options matter. First are
254 parsed (if any) the xrdb options, then the command line flags
255 .Sy in the provided order!
256 That meas that if you're providing first the x coordinate, let's say
259 you are overriding the width, the window
263 As a general rule of thumb, if you're overriding the width and/or the
264 height of the window, remember to override the x and y coordinates as