Blame


1 f5e234d6 2018-05-18 omar.polo .Dd $Mdocdate$
2 f5e234d6 2018-05-18 omar.polo .Dt MYMENU 1
3 f5e234d6 2018-05-18 omar.polo .Os
4 f5e234d6 2018-05-18 omar.polo .Sh NAME
5 f5e234d6 2018-05-18 omar.polo .Nm mymenu
6 f5e234d6 2018-05-18 omar.polo .Nd simple menu for XOrg
7 ae801529 2018-07-13 omar.polo .Sh SYNOPSIS
8 ae801529 2018-07-13 omar.polo .Nm
9 ae801529 2018-07-13 omar.polo .Bk -words
10 3518f203 2018-07-21 omar.polo .Op Fl hvaA
11 ae801529 2018-07-13 omar.polo .Op Fl p Ar prompt
12 ae801529 2018-07-13 omar.polo .Op Fl x Ar coord
13 ae801529 2018-07-13 omar.polo .Op Fl y Ar coord
14 844addbb 2018-07-15 omar.polo .Op Fl W Ar width
15 844addbb 2018-07-15 omar.polo .Op Fl H Ar height
16 ae801529 2018-07-13 omar.polo .Op Fl P Ar padding
17 ae801529 2018-07-13 omar.polo .Op Fl l Ar layout
18 ae801529 2018-07-13 omar.polo .Op Fl f Ar font
19 ae801529 2018-07-13 omar.polo .Op Fl b Ar borders
20 844addbb 2018-07-15 omar.polo .Op Fl B Ar colors
21 ae801529 2018-07-13 omar.polo .Op Fl t Ar color
22 ae801529 2018-07-13 omar.polo .Op Fl T Ar color
23 ae801529 2018-07-13 omar.polo .Op Fl c Ar color
24 ae801529 2018-07-13 omar.polo .Op Fl C Ar color
25 ae801529 2018-07-13 omar.polo .Op Fl s Ar color
26 ae801529 2018-07-13 omar.polo .Op Fl S Ar color
27 844addbb 2018-07-15 omar.polo .Op Fl w Ar window
28 3518f203 2018-07-21 omar.polo .Op Fl d Ar separator
29 ae801529 2018-07-13 omar.polo .Ek
30 f5e234d6 2018-05-18 omar.polo .Sh DESCRIPTION
31 f5e234d6 2018-05-18 omar.polo The
32 f5e234d6 2018-05-18 omar.polo .Nm
33 f5e234d6 2018-05-18 omar.polo utility a simple graphical menu for XOrg. It read the items from
34 f5e234d6 2018-05-18 omar.polo .Ic stdin
35 f5e234d6 2018-05-18 omar.polo and print the user selection to
36 f5e234d6 2018-05-18 omar.polo .Ic stdout
37 f5e234d6 2018-05-18 omar.polo on exit.
38 ae801529 2018-07-13 omar.polo
39 ae801529 2018-07-13 omar.polo The following options are available and take the maximum precedence
40 ae801529 2018-07-13 omar.polo over the (respective) ones defined in the
41 ae801529 2018-07-13 omar.polo .Sy X Resource Database
42 ae801529 2018-07-13 omar.polo .Bl -tag -width indent-two
43 b500fe86 2018-06-07 omar.polo .It Fl h
44 b500fe86 2018-06-07 omar.polo Print a small usage message to stderr.
45 b500fe86 2018-06-07 omar.polo .It Fl v
46 b500fe86 2018-06-07 omar.polo Print version and exit.
47 ae801529 2018-07-13 omar.polo .It Fl a
48 ae801529 2018-07-13 omar.polo The first completion (if any) is always selected. This is like dmenu.
49 3518f203 2018-07-21 omar.polo .It Fl A
50 3518f203 2018-07-21 omar.polo The user must chose one of the option (or none) and is not able to
51 3518f203 2018-07-21 omar.polo arbitrary enter text
52 ae801529 2018-07-13 omar.polo .It Fl p Ar prompt
53 ae801529 2018-07-13 omar.polo Override the prompt
54 ae801529 2018-07-13 omar.polo .It Fl x Ar val
55 ae801529 2018-07-13 omar.polo Override the positioning on the X axis, parsed as the resource MyMenu.x
56 ae801529 2018-07-13 omar.polo .It Fl y Ar val
57 ae801529 2018-07-13 omar.polo Override the positioning on the Y axis, parsed as the resource MyMenu.y
58 ae801529 2018-07-13 omar.polo .It Fl P Ar padding
59 ae801529 2018-07-13 omar.polo Override the padding. See the MyMenu.padding resource.
60 ae801529 2018-07-13 omar.polo .It Fl l Ar layout
61 ae801529 2018-07-13 omar.polo Override the layout. Parsed as MyMenu.layout.
62 ae801529 2018-07-13 omar.polo .It Fl f Ar font
63 ae801529 2018-07-13 omar.polo Override the font. See MyMenu.font.
64 ae801529 2018-07-13 omar.polo .It Fl w Ar val
65 ae801529 2018-07-13 omar.polo Override the width. Parsed as MyMenu.width.
66 ae801529 2018-07-13 omar.polo .It Fl h Ar val
67 ae801529 2018-07-13 omar.polo Override the height. Parsed as MyMenu.height.
68 ae801529 2018-07-13 omar.polo .It Fl b Ar borders
69 ae801529 2018-07-13 omar.polo Override the borders size. Parsed as MyMenu.border.size.
70 ae801529 2018-07-13 omar.polo .It Fl B Ar colors
71 ae801529 2018-07-13 omar.polo Override the borders color. Parsed as MyMenu.border.color.
72 ae801529 2018-07-13 omar.polo .It Fl t Ar color
73 ae801529 2018-07-13 omar.polo Override the prompt foreground color. See MyMenu.prompt.foreground.
74 ae801529 2018-07-13 omar.polo .It Fl T Ar color
75 ae801529 2018-07-13 omar.polo Override the prompt background color. See MyMenu.prompt.background.
76 ae801529 2018-07-13 omar.polo .It Fl c Ar color
77 3518f203 2018-07-21 omar.polo Override the completion foreground color. See
78 3518f203 2018-07-21 omar.polo MyMenu.completion.foreground.
79 ae801529 2018-07-13 omar.polo .It Fl C Ar color
80 3518f203 2018-07-21 omar.polo Override the completion background color. See
81 3518f203 2018-07-21 omar.polo MyMenu.completion.background.
82 ae801529 2018-07-13 omar.polo .It Fl s Ar color
83 3518f203 2018-07-21 omar.polo Override the highlighted completion foreground color. See
84 3518f203 2018-07-21 omar.polo MyMenu.completion_highlighted.foreground.
85 ae801529 2018-07-13 omar.polo .It Fl S Ar color
86 3518f203 2018-07-21 omar.polo Override the highlighted completion background color. See
87 3518f203 2018-07-21 omar.polo MyMenu.completion_highlighted.background.
88 844addbb 2018-07-15 omar.polo .It Fl w Ar window
89 844addbb 2018-07-15 omar.polo Embed into the given window id.
90 3518f203 2018-07-21 omar.polo .It Fl d Ar sep
91 ab1bb640 2018-07-27 omar.polo Optionally show only the text after the given separator. Defaults
92 ab1bb640 2018-07-27 omar.polo to the whole line if the separator is not present.
93 8d9debb1 2018-06-07 omar.polo .El
94 f5e234d6 2018-05-18 omar.polo .Sh RESOURCES
95 f5e234d6 2018-05-18 omar.polo .Bl -tag -width Ds
96 f5e234d6 2018-05-18 omar.polo .It MyMenu.font
97 9e94fcbe 2018-05-22 omar.polo The font name to use. By default is set to "fixed" if compiled without
98 9e94fcbe 2018-05-22 omar.polo Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
99 9e94fcbe 2018-05-22 omar.polo are supported.
100 36a15a9f 2018-05-19 omar.polo .It MyMenu.layout
101 36a15a9f 2018-05-19 omar.polo The layout of the menu. The possible values are "horizontal" and
102 36a15a9f 2018-05-19 omar.polo "vertical", with the default being "horizontal". Every other value
103 36a15a9f 2018-05-19 omar.polo than "horizontal" is treated like "vertical", but this is kinda an
104 36a15a9f 2018-05-19 omar.polo implementation detail and not something to be relied on, since in the
105 8758854a 2018-05-20 omar.polo future other layout could be added as well.
106 8758854a 2018-05-20 omar.polo .It Mymenu.prompt
107 8758854a 2018-05-20 omar.polo A string that is rendered before the user input. Default to "$ ".
108 f5e234d6 2018-05-18 omar.polo .It MyMenu.width
109 f5e234d6 2018-05-18 omar.polo The width of the menu. If a numeric value is given (e.g. 400) is
110 f5e234d6 2018-05-18 omar.polo interpreted as pixel, if it ends with a percentage symbol `%'
111 f5e234d6 2018-05-18 omar.polo (e.g. 40%) the relative percentage will be computed (relative to the
112 8758854a 2018-05-20 omar.polo monitor width).
113 f5e234d6 2018-05-18 omar.polo .It MyMenu.height
114 f5e234d6 2018-05-18 omar.polo The height of the menu. Like MyMenu.width if a numeric value is given
115 f5e234d6 2018-05-18 omar.polo is interpreted as pixel, if it ends with a percentage symbol `%' the
116 8758854a 2018-05-20 omar.polo relative percentage will be computed (relative to the monitor height).
117 f5e234d6 2018-05-18 omar.polo .It MyMenu.x
118 f5e234d6 2018-05-18 omar.polo The X coordinate of the topmost left corner of the window. Much like
119 f5e234d6 2018-05-18 omar.polo MyMenu.height and MyMenu.width both a pixel dimension and percentage
120 8e122ff1 2018-07-13 omar.polo could be supplied. In addition to it, some special value can be used.
121 8e122ff1 2018-07-13 omar.polo .Bl -tag
122 8e122ff1 2018-07-13 omar.polo .It start
123 8e122ff1 2018-07-13 omar.polo Alias for 0;
124 8e122ff1 2018-07-13 omar.polo .It middle
125 8e122ff1 2018-07-13 omar.polo Compute the correct value to make sure that mymenu will be
126 8e122ff1 2018-07-13 omar.polo horizontally centered;
127 8e122ff1 2018-07-13 omar.polo .It end
128 8e122ff1 2018-07-13 omar.polo Compute the correct value to make sure that mymenu will be right
129 8e122ff1 2018-07-13 omar.polo aligned.
130 8e122ff1 2018-07-13 omar.polo .El
131 f5e234d6 2018-05-18 omar.polo .It MyMenu.y
132 f5e234d6 2018-05-18 omar.polo The Y coordinate of the topmost left corner of the window. Like the X
133 e5186d6b 2018-05-26 omar.polo coordinate a pixel dimension, percentage dimension or the special
134 8e122ff1 2018-07-13 omar.polo value "start", "middle", "end" could be supplied.
135 e5186d6b 2018-05-26 omar.polo .It MyMenu.padding
136 e5186d6b 2018-05-26 omar.polo Change the padding. In the horizontal layout the padding is the space
137 e5186d6b 2018-05-26 omar.polo between the rectangle of the completion and the text as well as the
138 e5186d6b 2018-05-26 omar.polo space between the prompt and the first completion. In the horizontal
139 e5186d6b 2018-05-26 omar.polo layout the padding is the horizontal spacing between the window edge
140 e5186d6b 2018-05-26 omar.polo and the text as well as the space up and down the text within the
141 e5186d6b 2018-05-26 omar.polo completion. The default value is 10.
142 500ca6c1 2018-07-08 omar.polo .It MyMenu.border.size
143 500ca6c1 2018-07-08 omar.polo A list of number separated by spaces to specify the border of the
144 500ca6c1 2018-07-08 omar.polo window. The field is parsed like some CSS properties (i.e. padding),
145 500ca6c1 2018-07-08 omar.polo that is: if only one value is provided then it'll be used for all
146 500ca6c1 2018-07-08 omar.polo borders; if two value are given than the first will be used for the
147 500ca6c1 2018-07-08 omar.polo top and bottom border and the former for the left and right border;
148 500ca6c1 2018-07-08 omar.polo with three value the first is used for the top border, the second for
149 500ca6c1 2018-07-08 omar.polo the left and right border and the third for the bottom border. If four
150 500ca6c1 2018-07-08 omar.polo value are given, they'll be applied to the respective border
151 500ca6c1 2018-07-08 omar.polo clockwise. Other values will be ignored. The default value is 0.
152 500ca6c1 2018-07-08 omar.polo .It MyMenu.border.color
153 500ca6c1 2018-07-08 omar.polo A list of colors for the borders. This field is parsed like the
154 500ca6c1 2018-07-08 omar.polo MyMenu.border.size. The default value is black.
155 f5e234d6 2018-05-18 omar.polo .It MyMenu.prompt.background
156 8758854a 2018-05-20 omar.polo The background of the prompt.
157 f5e234d6 2018-05-18 omar.polo .It MyMenu.prompt.foreground
158 8758854a 2018-05-20 omar.polo The text color (foreground) of the prompt.
159 f5e234d6 2018-05-18 omar.polo .It MyMenu.completion.background
160 8758854a 2018-05-20 omar.polo The background of the completions.
161 f5e234d6 2018-05-18 omar.polo .It MyMenu.completion.foreground
162 8758854a 2018-05-20 omar.polo The text color of the completions.
163 f5e234d6 2018-05-18 omar.polo .It MyMenu.completion_highlighted.background
164 8758854a 2018-05-20 omar.polo The background of the selected completion.
165 f5e234d6 2018-05-18 omar.polo .It MyMenu.completion_highlighted.foreground
166 8758854a 2018-05-20 omar.polo The foreground of the selected completion.
167 f5e234d6 2018-05-18 omar.polo .El
168 f5e234d6 2018-05-18 omar.polo
169 f5e234d6 2018-05-18 omar.polo .Sh KEYS
170 bee0837c 2018-07-01 omar.polo This is the list of keybinding recognized by
171 bee0837c 2018-07-01 omar.polo .Li Nm Ns .
172 bee0837c 2018-07-01 omar.polo In the following examples, C-c means Control-c.
173 f5e234d6 2018-05-18 omar.polo .Bl -tag -width indent-two
174 f5e234d6 2018-05-18 omar.polo .It Esc
175 f5e234d6 2018-05-18 omar.polo Close the menu without selecting any entry
176 bee0837c 2018-07-01 omar.polo .It C-c
177 bee0837c 2018-07-01 omar.polo The same as Esc
178 f5e234d6 2018-05-18 omar.polo .It Enter
179 f5e234d6 2018-05-18 omar.polo Close the menu and print to stdout what the user typed
180 347d23da 2018-05-19 omar.polo .It C-m
181 347d23da 2018-05-19 omar.polo The same as Enter
182 f5e234d6 2018-05-18 omar.polo .It Tab
183 f5e234d6 2018-05-18 omar.polo Expand the prompt to the next possible completion
184 f5e234d6 2018-05-18 omar.polo .It Shift Tab
185 f5e234d6 2018-05-18 omar.polo Expand the prompt to the previous possible completion
186 8ecd98cc 2018-05-25 omar.polo .It C-n
187 8ecd98cc 2018-05-25 omar.polo The same as Tab
188 8ecd98cc 2018-05-25 omar.polo .It C-p
189 8ecd98cc 2018-05-25 omar.polo The same as Shift-Tab
190 f5e234d6 2018-05-18 omar.polo .It Backspace
191 f5e234d6 2018-05-18 omar.polo Delete the last character
192 347d23da 2018-05-19 omar.polo .It C-h
193 347d23da 2018-05-19 omar.polo The same as Backspace
194 347d23da 2018-05-19 omar.polo .It C-w
195 347d23da 2018-05-19 omar.polo Delete the last word
196 347d23da 2018-05-19 omar.polo .It C-u
197 347d23da 2018-05-19 omar.polo Delete the whole line
198 6254fed8 2018-07-06 omar.polo .It C-i
199 6254fed8 2018-07-06 omar.polo Toggle the ``first selected'' style. Sometimes, especially with the -a
200 6254fed8 2018-07-06 omar.polo option, could be handy to disable that behaviour. Let's say that
201 6254fed8 2018-07-06 omar.polo you've typed ``fire'' and the first completion is ``firefox'' but you
202 6254fed8 2018-07-06 omar.polo really want to choose ``fire''. While you can type some spaces, this
203 6254fed8 2018-07-06 omar.polo keybinding is a more elegant way to change, at runtime, the behaviour
204 6254fed8 2018-07-06 omar.polo of the first completion.
205 f5e234d6 2018-05-18 omar.polo .El
206 3518f203 2018-07-21 omar.polo .Sh EXIT STATUS
207 f5e234d6 2018-05-18 omar.polo
208 3518f203 2018-07-21 omar.polo 0 when the user select an entry, 1 when the user press Esc, EX_USAGE
209 3518f203 2018-07-21 omar.polo if used with wrong flags and EX_UNAVAILABLE if the connection to X
210 3518f203 2018-07-21 omar.polo fails.
211 3518f203 2018-07-21 omar.polo .Sh EXAMPLES
212 3518f203 2018-07-21 omar.polo .Bl -bullet -bullet
213 3518f203 2018-07-21 omar.polo .It
214 3518f203 2018-07-21 omar.polo Create a simple menu with a couple of entry
215 3518f203 2018-07-21 omar.polo .Bd -literal -offset indent
216 3518f203 2018-07-21 omar.polo cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
217 3518f203 2018-07-21 omar.polo firefox
218 3518f203 2018-07-21 omar.polo zzz
219 3518f203 2018-07-21 omar.polo xcalc -stipple
220 3518f203 2018-07-21 omar.polo xlock
221 3518f203 2018-07-21 omar.polo gimp
222 3518f203 2018-07-21 omar.polo EOF
223 3518f203 2018-07-21 omar.polo .Ed
224 3518f203 2018-07-21 omar.polo .It
225 3518f203 2018-07-21 omar.polo Select and play a song from the current mpd playlist
226 3518f203 2018-07-21 omar.polo .Bd -literal -offset indent
227 3518f203 2018-07-21 omar.polo filter="%position%) %artist% - %title%"
228 3518f203 2018-07-21 omar.polo if song=$(mpc playlist -f "$filter" | mymenu -p "Song: " -A -d ") "); then
229 3518f203 2018-07-21 omar.polo mpc play $(echo $song | sed "s/).*$//")
230 3518f203 2018-07-21 omar.polo fi
231 3518f203 2018-07-21 omar.polo .Ed
232 3518f203 2018-07-21 omar.polo .El
233 3518f203 2018-07-21 omar.polo
234 3518f203 2018-07-21 omar.polo .Sh SEE ALSO
235 3518f203 2018-07-21 omar.polo .Xr dmenu 1
236 3518f203 2018-07-21 omar.polo .Xr sysexits 3
237 3518f203 2018-07-21 omar.polo
238 3518f203 2018-07-21 omar.polo .Sh AUTHORS
239 3518f203 2018-07-21 omar.polo .An Omar Polo <omar.polo@europecom.net>
240 3518f203 2018-07-21 omar.polo
241 f5e234d6 2018-05-18 omar.polo .Sh BUGS
242 f5e234d6 2018-05-18 omar.polo .Bl -bullet
243 f5e234d6 2018-05-18 omar.polo .It
244 f5e234d6 2018-05-18 omar.polo If, instead of a numeric value, a not-valid number that terminates
245 f5e234d6 2018-05-18 omar.polo with the % sign is supplied, then the default value for that field
246 f5e234d6 2018-05-18 omar.polo will be treated as a percentage. Since this is a misuse of the
247 f5e234d6 2018-05-18 omar.polo resources this behavior isn't strictly considered a bug.
248 9e94fcbe 2018-05-22 omar.polo .It
249 ae801529 2018-07-13 omar.polo Keep in mind that sometimes the order of the options matter. First are
250 ae801529 2018-07-13 omar.polo parsed (if any) the xrdb options, then the command line flags
251 ae801529 2018-07-13 omar.polo .Sy in the provided order!
252 ae801529 2018-07-13 omar.polo That meas that if you're providing first the x coordinate, let's say
253 ae801529 2018-07-13 omar.polo "middle", and
254 ae801529 2018-07-13 omar.polo .Sy after that
255 ae801529 2018-07-13 omar.polo you are overriding the width, the window
256 ae801529 2018-07-13 omar.polo .Sy will not be
257 ae801529 2018-07-13 omar.polo centered.
258 ae801529 2018-07-13 omar.polo
259 ae801529 2018-07-13 omar.polo As a general rule of thumb, if you're overriding the width and/or the
260 ae801529 2018-07-13 omar.polo height of the window, remember to override the x and y coordinates as
261 ae801529 2018-07-13 omar.polo well.
262 f5e234d6 2018-05-18 omar.polo .El