Blob


1 .Dd $Mdocdate$
2 .Dt MYMENU 1
3 .Os
4 .Sh NAME
5 .Nm mymenu
6 .Nd simple menu for XOrg
7 .Sh SYNOPSIS
8 .Nm
9 .Bk -words
10 .Op Fl Aamvh
11 .Op Fl B Ar colors
12 .Op Fl b Ar borders
13 .Op Fl C Ar color
14 .Op Fl c Ar color
15 .Op Fl d Ar separator
16 .Op Fl e Ar window
17 .Op Fl f Ar font
18 .Op Fl H Ar height
19 .Op Fl l Ar layout
20 .Op Fl P Ar padding
21 .Op Fl p Ar prompt
22 .Op Fl T Ar color
23 .Op Fl t Ar color
24 .Op Fl S Ar color
25 .Op Fl s Ar color
26 .Op Fl W Ar width
27 .Op Fl x Ar coord
28 .Op Fl y Ar coord
29 .Ek
30 .Sh DESCRIPTION
31 The
32 .Nm
33 utility a simple graphical menu for XOrg. It read the items from
34 .Ic stdin
35 and print the user selection to
36 .Ic stdout
37 on exit.
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
43 .It Fl A
44 The user must chose one of the option (or none) and is not able to
45 arbitrary enter text
46 .It Fl a
47 The first completion (if any) is always selected. This is like dmenu.
48 .It Fl B Ar colors
49 Override the borders color. Parsed as MyMenu.border.color.
50 .It Fl b Ar borders
51 Override the borders size. Parsed as MyMenu.border.size.
52 .It Fl C Ar color
53 Override the completion background color. See
54 MyMenu.completion.background.
55 .It Fl c Ar color
56 Override the completion foreground color. See
57 MyMenu.completion.foreground.
58 .It Fl d Ar separator
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.
63 .It Fl e Ar windowid
64 Embed into the given window id.
65 .It Fl H Ar val
66 Override the height. Parsed as MyMenu.height.
67 .It Fl h
68 Print a small usage message to stderr.
69 .It Fl f Ar font
70 Override the font. See MyMenu.font.
71 .It Fl l Ar layout
72 Override the layout. Parsed as MyMenu.layout.
73 .It Fl m
74 The user can select multiple entry via C-m. Please consult
75 .Sx KEYS
76 for more info.
77 .It Fl P Ar padding
78 Override the padding. See the MyMenu.padding resource.
79 .It Fl p Ar prompt
80 Override the prompt
81 .It Fl S Ar color
82 Override the highlighted completion background color. See
83 MyMenu.completion_highlighted.background.
84 .It Fl s Ar color
85 Override the highlighted completion foreground color. See
86 MyMenu.completion_highlighted.foreground.
87 .It Fl T Ar color
88 Override the prompt background color. See MyMenu.prompt.background.
89 .It Fl t Ar color
90 Override the prompt foreground color. See MyMenu.prompt.foreground.
91 .It Fl v
92 Print version and exit.
93 .It Fl W Ar val
94 Override the width. Parsed as MyMenu.width.
95 .It Fl x Ar val
96 Override the positioning on the X axis, parsed as the resource MyMenu.x
97 .It Fl y Ar val
98 Override the positioning on the Y axis, parsed as the resource MyMenu.y
99 .El
100 .Sh RESOURCES
101 .Bl -tag -width Ds
102 .It MyMenu.font
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
105 are supported.
106 .It MyMenu.layout
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.
112 .It Mymenu.prompt
113 A string that is rendered before the user input. Default to "$ ".
114 .It MyMenu.width
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
118 monitor width).
119 .It MyMenu.height
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).
123 .It MyMenu.x
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.
127 .Bl -tag
128 .It start
129 Alias for 0;
130 .It middle
131 Compute the correct value to make sure that mymenu will be
132 horizontally centered;
133 .It end
134 Compute the correct value to make sure that mymenu will be right
135 aligned.
136 .El
137 .It MyMenu.y
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.
141 .It MyMenu.padding
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.
173 .El
174 .Sh COLORS
175 MyMenu accept colors only in the form of:
176 .Bl -bullet
177 .It
178 #rgb
179 .It
180 #rrggbb
181 .It
182 #aarrggbb
183 .El
185 The opacity is assumed 0xff (no transparency) if not provided.
186 .Sh KEYS
187 This is the list of keybinding recognized by
188 .Li Nm Ns .
189 In the following examples, C-c means Control-c.
190 .Bl -tag -width indent-two
191 .It Esc
192 Close the menu without selecting any entry
193 .It C-c
194 The same as Esc
195 .It Enter
196 Close the menu and print to stdout what the user typed
197 .It C-m
198 Confirm but keep looping (if enabled), otherwise complete only
199 .It Tab
200 Expand the prompt to the next possible completion
201 .It Shift Tab
202 Expand the prompt to the previous possible completion
203 .It C-n
204 The same as Tab
205 .It C-p
206 The same as Shift-Tab
207 .It Backspace
208 Delete the last character
209 .It C-h
210 The same as Backspace
211 .It C-w
212 Delete the last word
213 .It C-u
214 Delete the whole line
215 .It C-i
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.
222 .El
223 .Sh EXIT STATUS
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
226 fails.
227 .Sh EXAMPLES
228 .Bl -bullet -bullet
229 .It
230 Create a simple menu with a couple of entry
231 .Bd -literal -offset indent
232 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
233 firefox
234 zzz
235 xcalc -stipple
236 xlock
237 gimp
238 EOF
239 .Ed
240 .It
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/ .*$//")
246 fi
247 .Ed
248 .El
250 .Sh SEE ALSO
251 .Xr dmenu 1
252 .Xr sysexits 3
254 .Sh AUTHORS
255 .An Omar Polo <omar.polo@europecom.net>
257 .Sh CAVEATS
258 .Bl -bullet
259 .It
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.
264 .It
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
269 "middle", and
270 .Sy after that
271 you are overriding the width, the window
272 .Sy will not be
273 centered.
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
277 well.
278 .El