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 hvaA
11 .Op Fl p Ar prompt
12 .Op Fl x Ar coord
13 .Op Fl y Ar coord
14 .Op Fl W Ar width
15 .Op Fl H Ar height
16 .Op Fl P Ar padding
17 .Op Fl l Ar layout
18 .Op Fl f Ar font
19 .Op Fl b Ar borders
20 .Op Fl B Ar colors
21 .Op Fl t Ar color
22 .Op Fl T Ar color
23 .Op Fl c Ar color
24 .Op Fl C Ar color
25 .Op Fl s Ar color
26 .Op Fl S Ar color
27 .Op Fl w Ar window
28 .Op Fl d Ar separator
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 h
44 Print a small usage message to stderr.
45 .It Fl v
46 Print version and exit.
47 .It Fl a
48 The first completion (if any) is always selected. This is like dmenu.
49 .It Fl A
50 The user must chose one of the option (or none) and is not able to
51 arbitrary enter text
52 .It Fl p Ar prompt
53 Override the prompt
54 .It Fl x Ar val
55 Override the positioning on the X axis, parsed as the resource MyMenu.x
56 .It Fl y Ar val
57 Override the positioning on the Y axis, parsed as the resource MyMenu.y
58 .It Fl P Ar padding
59 Override the padding. See the MyMenu.padding resource.
60 .It Fl l Ar layout
61 Override the layout. Parsed as MyMenu.layout.
62 .It Fl f Ar font
63 Override the font. See MyMenu.font.
64 .It Fl w Ar val
65 Override the width. Parsed as MyMenu.width.
66 .It Fl h Ar val
67 Override the height. Parsed as MyMenu.height.
68 .It Fl b Ar borders
69 Override the borders size. Parsed as MyMenu.border.size.
70 .It Fl B Ar colors
71 Override the borders color. Parsed as MyMenu.border.color.
72 .It Fl t Ar color
73 Override the prompt foreground color. See MyMenu.prompt.foreground.
74 .It Fl T Ar color
75 Override the prompt background color. See MyMenu.prompt.background.
76 .It Fl c Ar color
77 Override the completion foreground color. See
78 MyMenu.completion.foreground.
79 .It Fl C Ar color
80 Override the completion background color. See
81 MyMenu.completion.background.
82 .It Fl s Ar color
83 Override the highlighted completion foreground color. See
84 MyMenu.completion_highlighted.foreground.
85 .It Fl S Ar color
86 Override the highlighted completion background color. See
87 MyMenu.completion_highlighted.background.
88 .It Fl w Ar window
89 Embed into the given window id.
90 .It Fl d Ar sep
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
93 showed to the user.
94 .El
95 .Sh RESOURCES
96 .Bl -tag -width Ds
97 .It MyMenu.font
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
100 are supported.
101 .It MyMenu.layout
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.
107 .It Mymenu.prompt
108 A string that is rendered before the user input. Default to "$ ".
109 .It MyMenu.width
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
113 monitor width).
114 .It MyMenu.height
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).
118 .It MyMenu.x
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.
122 .Bl -tag
123 .It start
124 Alias for 0;
125 .It middle
126 Compute the correct value to make sure that mymenu will be
127 horizontally centered;
128 .It end
129 Compute the correct value to make sure that mymenu will be right
130 aligned.
131 .El
132 .It MyMenu.y
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.
136 .It MyMenu.padding
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.
168 .El
170 .Sh KEYS
171 This is the list of keybinding recognized by
172 .Li Nm Ns .
173 In the following examples, C-c means Control-c.
174 .Bl -tag -width indent-two
175 .It Esc
176 Close the menu without selecting any entry
177 .It C-c
178 The same as Esc
179 .It Enter
180 Close the menu and print to stdout what the user typed
181 .It C-m
182 The same as Enter
183 .It Tab
184 Expand the prompt to the next possible completion
185 .It Shift Tab
186 Expand the prompt to the previous possible completion
187 .It C-n
188 The same as Tab
189 .It C-p
190 The same as Shift-Tab
191 .It Backspace
192 Delete the last character
193 .It C-h
194 The same as Backspace
195 .It C-w
196 Delete the last word
197 .It C-u
198 Delete the whole line
199 .It C-i
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.
206 .El
207 .Sh EXIT STATUS
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
211 fails.
212 .Sh EXAMPLES
213 .Bl -bullet -bullet
214 .It
215 Create a simple menu with a couple of entry
216 .Bd -literal -offset indent
217 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
218 firefox
219 zzz
220 xcalc -stipple
221 xlock
222 gimp
223 EOF
224 .Ed
225 .It
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/).*$//")
231 fi
232 .Ed
233 .El
235 .Sh SEE ALSO
236 .Xr dmenu 1
237 .Xr sysexits 3
239 .Sh AUTHORS
240 .An Omar Polo <omar.polo@europecom.net>
242 .Sh BUGS
243 .Bl -bullet
244 .It
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.
249 .It
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
254 "middle", and
255 .Sy after that
256 you are overriding the width, the window
257 .Sy will not be
258 centered.
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
262 well.
263 .El