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 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 e 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 m
53 The user can select multiple entry via C-m. Please consult
54 .Sx KEYS
55 for more info.
56 .It Fl p Ar prompt
57 Override the prompt
58 .It Fl x Ar val
59 Override the positioning on the X axis, parsed as the resource MyMenu.x
60 .It Fl y Ar val
61 Override the positioning on the Y axis, parsed as the resource MyMenu.y
62 .It Fl P Ar padding
63 Override the padding. See the MyMenu.padding resource.
64 .It Fl l Ar layout
65 Override the layout. Parsed as MyMenu.layout.
66 .It Fl f Ar font
67 Override the font. See MyMenu.font.
68 .It Fl w Ar val
69 Override the width. Parsed as MyMenu.width.
70 .It Fl h Ar val
71 Override the height. Parsed as MyMenu.height.
72 .It Fl b Ar borders
73 Override the borders size. Parsed as MyMenu.border.size.
74 .It Fl B Ar colors
75 Override the borders color. Parsed as MyMenu.border.color.
76 .It Fl t Ar color
77 Override the prompt foreground color. See MyMenu.prompt.foreground.
78 .It Fl T Ar color
79 Override the prompt background color. See MyMenu.prompt.background.
80 .It Fl c Ar color
81 Override the completion foreground color. See
82 MyMenu.completion.foreground.
83 .It Fl C Ar color
84 Override the completion background color. See
85 MyMenu.completion.background.
86 .It Fl s Ar color
87 Override the highlighted completion foreground color. See
88 MyMenu.completion_highlighted.foreground.
89 .It Fl S Ar color
90 Override the highlighted completion background color. See
91 MyMenu.completion_highlighted.background.
92 .It Fl w Ar window
93 Embed into the given window id.
94 .It Fl d Ar sep
95 Optionally show only the text after the given separator. Defaults
96 to the whole line if the separator is not present.
97 .El
98 .Sh RESOURCES
99 .Bl -tag -width Ds
100 .It MyMenu.font
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
103 are supported.
104 .It MyMenu.layout
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.
110 .It Mymenu.prompt
111 A string that is rendered before the user input. Default to "$ ".
112 .It MyMenu.width
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
116 monitor width).
117 .It MyMenu.height
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).
121 .It MyMenu.x
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.
125 .Bl -tag
126 .It start
127 Alias for 0;
128 .It middle
129 Compute the correct value to make sure that mymenu will be
130 horizontally centered;
131 .It end
132 Compute the correct value to make sure that mymenu will be right
133 aligned.
134 .El
135 .It MyMenu.y
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.
139 .It MyMenu.padding
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.
171 .El
173 .Sh KEYS
174 This is the list of keybinding recognized by
175 .Li Nm Ns .
176 In the following examples, C-c means Control-c.
177 .Bl -tag -width indent-two
178 .It Esc
179 Close the menu without selecting any entry
180 .It C-c
181 The same as Esc
182 .It Enter
183 Close the menu and print to stdout what the user typed
184 .It C-m
185 Confirm but keep looping (if enabled), otherwise complete only
186 .It Tab
187 Expand the prompt to the next possible completion
188 .It Shift Tab
189 Expand the prompt to the previous possible completion
190 .It C-n
191 The same as Tab
192 .It C-p
193 The same as Shift-Tab
194 .It Backspace
195 Delete the last character
196 .It C-h
197 The same as Backspace
198 .It C-w
199 Delete the last word
200 .It C-u
201 Delete the whole line
202 .It C-i
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.
209 .El
210 .Sh EXIT STATUS
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
214 fails.
215 .Sh EXAMPLES
216 .Bl -bullet -bullet
217 .It
218 Create a simple menu with a couple of entry
219 .Bd -literal -offset indent
220 cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
221 firefox
222 zzz
223 xcalc -stipple
224 xlock
225 gimp
226 EOF
227 .Ed
228 .It
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/).*$//")
234 fi
235 .Ed
236 .El
238 .Sh SEE ALSO
239 .Xr dmenu 1
240 .Xr sysexits 3
242 .Sh AUTHORS
243 .An Omar Polo <omar.polo@europecom.net>
245 .Sh CAVEATS
246 .Bl -bullet
247 .It
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.
252 .It
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
257 "middle", and
258 .Sy after that
259 you are overriding the width, the window
260 .Sy will not be
261 centered.
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
265 well.
266 .El