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 Optionally show only the text after the given separator. Defaults
92 to the whole line if the separator is not present.
93 .El
94 .Sh RESOURCES
95 .Bl -tag -width Ds
96 .It MyMenu.font
97 The font name to use. By default is set to "fixed" if compiled without
98 Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
99 are supported.
100 .It MyMenu.layout
101 The layout of the menu. The possible values are "horizontal" and
102 "vertical", with the default being "horizontal". Every other value
103 than "horizontal" is treated like "vertical", but this is kinda an
104 implementation detail and not something to be relied on, since in the
105 future other layout could be added as well.
106 .It Mymenu.prompt
107 A string that is rendered before the user input. Default to "$ ".
108 .It MyMenu.width
109 The width of the menu. If a numeric value is given (e.g. 400) is
110 interpreted as pixel, if it ends with a percentage symbol `%'
111 (e.g. 40%) the relative percentage will be computed (relative to the
112 monitor width).
113 .It MyMenu.height
114 The height of the menu. Like MyMenu.width if a numeric value is given
115 is interpreted as pixel, if it ends with a percentage symbol `%' the
116 relative percentage will be computed (relative to the monitor height).
117 .It MyMenu.x
118 The X coordinate of the topmost left corner of the window. Much like
119 MyMenu.height and MyMenu.width both a pixel dimension and percentage
120 could be supplied. In addition to it, some special value can be used.
121 .Bl -tag
122 .It start
123 Alias for 0;
124 .It middle
125 Compute the correct value to make sure that mymenu will be
126 horizontally centered;
127 .It end
128 Compute the correct value to make sure that mymenu will be right
129 aligned.
130 .El
131 .It MyMenu.y
132 The Y coordinate of the topmost left corner of the window. Like the X
133 coordinate a pixel dimension, percentage dimension or the special
134 value "start", "middle", "end" could be supplied.
135 .It MyMenu.padding
136 Change the padding. In the horizontal layout the padding is the space
137 between the rectangle of the completion and the text as well as the
138 space between the prompt and the first completion. In the horizontal
139 layout the padding is the horizontal spacing between the window edge
140 and the text as well as the space up and down the text within the
141 completion. The default value is 10.
142 .It MyMenu.border.size
143 A list of number separated by spaces to specify the border of the
144 window. The field is parsed like some CSS properties (i.e. padding),
145 that is: if only one value is provided then it'll be used for all
146 borders; if two value are given than the first will be used for the
147 top and bottom border and the former for the left and right border;
148 with three value the first is used for the top border, the second for
149 the left and right border and the third for the bottom border. If four
150 value are given, they'll be applied to the respective border
151 clockwise. Other values will be ignored. The default value is 0.
152 .It MyMenu.border.color
153 A list of colors for the borders. This field is parsed like the
154 MyMenu.border.size. The default value is black.
155 .It MyMenu.prompt.background
156 The background of the prompt.
157 .It MyMenu.prompt.foreground
158 The text color (foreground) of the prompt.
159 .It MyMenu.completion.background
160 The background of the completions.
161 .It MyMenu.completion.foreground
162 The text color of the completions.
163 .It MyMenu.completion_highlighted.background
164 The background of the selected completion.
165 .It MyMenu.completion_highlighted.foreground
166 The foreground of the selected completion.
167 .El
169 .Sh KEYS
170 This is the list of keybinding recognized by
171 .Li Nm Ns .
172 In the following examples, C-c means Control-c.
173 .Bl -tag -width indent-two
174 .It Esc
175 Close the menu without selecting any entry
176 .It C-c
177 The same as Esc
178 .It Enter
179 Close the menu and print to stdout what the user typed
180 .It C-m
181 The same as Enter
182 .It Tab
183 Expand the prompt to the next possible completion
184 .It Shift Tab
185 Expand the prompt to the previous possible completion
186 .It C-n
187 The same as Tab
188 .It C-p
189 The same as Shift-Tab
190 .It Backspace
191 Delete the last character
192 .It C-h
193 The same as Backspace
194 .It C-w
195 Delete the last word
196 .It C-u
197 Delete the whole line
198 .It C-i
199 Toggle the ``first selected'' style. Sometimes, especially with the -a
200 option, could be handy to disable that behaviour. Let's say that
201 you've typed ``fire'' and the first completion is ``firefox'' but you
202 really want to choose ``fire''. While you can type some spaces, this
203 keybinding is a more elegant way to change, at runtime, the behaviour
204 of the first completion.
205 .El
206 .Sh EXIT STATUS
208 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
209 if used with wrong flags and EX_UNAVAILABLE if the connection to X
210 fails.
211 .Sh EXAMPLES
212 .Bl -bullet -bullet
213 .It
214 Create a simple menu with a couple of entry
215 .Bd -literal -offset indent
216 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
217 firefox
218 zzz
219 xcalc -stipple
220 xlock
221 gimp
222 EOF
223 .Ed
224 .It
225 Select and play a song from the current mpd playlist
226 .Bd -literal -offset indent
227 filter="%position%) %artist% - %title%"
228 if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
229 mpc play $(echo $song | sed "s/).*$//")
230 fi
231 .Ed
232 .El
234 .Sh SEE ALSO
235 .Xr dmenu 1
236 .Xr sysexits 3
238 .Sh AUTHORS
239 .An Omar Polo <omar.polo@europecom.net>
241 .Sh BUGS
242 .Bl -bullet
243 .It
244 If, instead of a numeric value, a not-valid number that terminates
245 with the % sign is supplied, then the default value for that field
246 will be treated as a percentage. Since this is a misuse of the
247 resources this behavior isn't strictly considered a bug.
248 .It
249 Keep in mind that sometimes the order of the options matter. First are
250 parsed (if any) the xrdb options, then the command line flags
251 .Sy in the provided order!
252 That meas that if you're providing first the x coordinate, let's say
253 "middle", and
254 .Sy after that
255 you are overriding the width, the window
256 .Sy will not be
257 centered.
259 As a general rule of thumb, if you're overriding the width and/or the
260 height of the window, remember to override the x and y coordinates as
261 well.
262 .El