Blame
Date:
Sun Oct 20 08:34:27 2019 UTC
Message:
Clicking on the prompt closes mymenu

added this behaviour and documentation
001
2018-05-18
omar.pol
.Dd $Mdocdate$
002
2018-05-18
omar.pol
.Dt MYMENU 1
003
2018-05-18
omar.pol
.Os
004
2018-05-18
omar.pol
.Sh NAME
005
2018-05-18
omar.pol
.Nm mymenu
006
2018-05-18
omar.pol
.Nd simple menu for XOrg
007
2018-07-13
omar.pol
.Sh SYNOPSIS
008
2018-07-13
omar.pol
.Nm
009
2018-07-13
omar.pol
.Bk -words
010
2018-10-17
omar.pol
.Op Fl Aahmv
011
2018-09-16
omar.pol
.Op Fl B Ar colors
012
2018-10-17
omar.pol
.Op Fl b Ar size
013
2018-09-16
omar.pol
.Op Fl C Ar color
014
2018-09-16
omar.pol
.Op Fl c Ar color
015
2018-09-16
omar.pol
.Op Fl d Ar separator
016
2018-09-16
omar.pol
.Op Fl e Ar window
017
2018-09-16
omar.pol
.Op Fl f Ar font
018
2018-10-17
omar.pol
.Op Fl G Ar color
019
2018-10-17
omar.pol
.Op Fl g Ar size
020
2018-07-15
omar.pol
.Op Fl H Ar height
021
2018-10-17
omar.pol
.Op Fl I Ar color
022
2018-10-17
omar.pol
.Op Fl i Ar size
023
2018-10-17
omar.pol
.Op Fl J Ar color
024
2018-10-17
omar.pol
.Op Fl j Ar size
025
2018-07-13
omar.pol
.Op Fl l Ar layout
026
2018-09-16
omar.pol
.Op Fl P Ar padding
027
2018-09-16
omar.pol
.Op Fl p Ar prompt
028
2018-07-13
omar.pol
.Op Fl S Ar color
029
2018-09-16
omar.pol
.Op Fl s Ar color
030
2018-10-17
omar.pol
.Op Fl T Ar color
031
2018-10-17
omar.pol
.Op Fl t Ar color
032
2018-09-16
omar.pol
.Op Fl W Ar width
033
2018-09-16
omar.pol
.Op Fl x Ar coord
034
2018-09-16
omar.pol
.Op Fl y Ar coord
035
2018-07-13
omar.pol
.Ek
036
2018-05-18
omar.pol
.Sh DESCRIPTION
037
2018-05-18
omar.pol
The
038
2018-05-18
omar.pol
.Nm
039
2018-05-18
omar.pol
utility a simple graphical menu for XOrg. It read the items from
040
2018-05-18
omar.pol
.Ic stdin
041
2018-05-18
omar.pol
and print the user selection to
042
2018-05-18
omar.pol
.Ic stdout
043
2018-05-18
omar.pol
on exit.
044
2018-07-13
omar.pol
045
2018-07-13
omar.pol
The following options are available and take the maximum precedence
046
2018-07-13
omar.pol
over the (respective) ones defined in the
047
2018-07-13
omar.pol
.Sy X Resource Database
048
2018-07-13
omar.pol
.Bl -tag -width indent-two
049
2018-07-21
omar.pol
.It Fl A
050
2018-07-21
omar.pol
The user must chose one of the option (or none) and is not able to
051
2018-07-21
omar.pol
arbitrary enter text
052
2018-09-16
omar.pol
.It Fl a
053
2018-09-16
omar.pol
The first completion (if any) is always selected. This is like dmenu.
054
2018-07-13
omar.pol
.It Fl B Ar colors
055
2018-07-13
omar.pol
Override the borders color. Parsed as MyMenu.border.color.
056
2018-09-16
omar.pol
.It Fl b Ar borders
057
2018-09-16
omar.pol
Override the borders size. Parsed as MyMenu.border.size.
058
2018-07-13
omar.pol
.It Fl C Ar color
059
2018-07-21
omar.pol
Override the completion background color. See
060
2018-07-21
omar.pol
MyMenu.completion.background.
061
2018-09-16
omar.pol
.It Fl c Ar color
062
2018-09-16
omar.pol
Override the completion foreground color. See
063
2018-09-16
omar.pol
MyMenu.completion.foreground.
064
2018-09-16
omar.pol
.It Fl d Ar separator
065
2018-10-17
omar.pol
Define a string to be used as a separator (mnemonic: delimiter). Only
066
2018-10-17
omar.pol
the text after the separator will be rendered, but the original string
067
2018-10-17
omar.pol
will be returned. Useful to embed custom data on every entry. See the
068
2018-10-17
omar.pol
mpd example for hints on how this can be useful.
069
2018-09-16
omar.pol
.It Fl e Ar windowid
070
2018-09-16
omar.pol
Embed into the given window id.
071
2018-10-17
omar.pol
.It Fl f Ar font
072
2018-10-17
omar.pol
Override the font. See MyMenu.font.
073
2018-10-17
omar.pol
.It Fl G Ar color
074
2018-10-17
omar.pol
Override the border colors of the prompt. See
075
2018-10-17
omar.pol
MyMenu.prompt.border.color.
076
2018-10-17
omar.pol
.It Fl g Ar size
077
2018-10-17
omar.pol
Override the border size of the prompt. See
078
2018-10-17
omar.pol
MyMenu.prompt.border.size.
079
2018-09-16
omar.pol
.It Fl H Ar val
080
2018-09-16
omar.pol
Override the height. Parsed as MyMenu.height.
081
2018-09-16
omar.pol
.It Fl h
082
2018-09-16
omar.pol
Print a small usage message to stderr.
083
2018-10-17
omar.pol
.It Fl I Ar color
084
2018-10-17
omar.pol
Override the border colors of the completion. See
085
2018-10-17
omar.pol
MyMenu.completion.border.color.
086
2018-10-17
omar.pol
.It Fl i Ar size
087
2018-10-17
omar.pol
Override the border size of the completion. See
088
2018-10-17
omar.pol
MyMenu.completion.border.size.
089
2018-10-17
omar.pol
.It Fl J Ar color
090
2018-10-17
omar.pol
Override the border colors of the completion. See
091
2018-10-17
omar.pol
MyMenu.completion_highlighted.border.color.
092
2018-10-17
omar.pol
.It Fl j Ar size
093
2018-10-17
omar.pol
Override the border size of the completion. See
094
2018-10-17
omar.pol
MyMenu.completion_highlighted.border.size.
095
2018-09-16
omar.pol
.It Fl l Ar layout
096
2018-09-16
omar.pol
Override the layout. Parsed as MyMenu.layout.
097
2018-09-16
omar.pol
.It Fl m
098
2018-09-16
omar.pol
The user can select multiple entry via C-m. Please consult
099
2018-09-16
omar.pol
.Sx KEYS
100
2018-09-16
omar.pol
for more info.
101
2018-09-16
omar.pol
.It Fl P Ar padding
102
2018-10-17
omar.pol
Override the padding. See the MyMenu.prompt.padding resource.
103
2018-09-16
omar.pol
.It Fl p Ar prompt
104
2018-09-16
omar.pol
Override the prompt
105
2018-07-13
omar.pol
.It Fl S Ar color
106
2018-07-21
omar.pol
Override the highlighted completion background color. See
107
2018-07-21
omar.pol
MyMenu.completion_highlighted.background.
108
2018-09-16
omar.pol
.It Fl s Ar color
109
2018-09-16
omar.pol
Override the highlighted completion foreground color. See
110
2018-09-16
omar.pol
MyMenu.completion_highlighted.foreground.
111
2018-09-16
omar.pol
.It Fl T Ar color
112
2018-09-16
omar.pol
Override the prompt background color. See MyMenu.prompt.background.
113
2018-09-16
omar.pol
.It Fl t Ar color
114
2018-09-16
omar.pol
Override the prompt foreground color. See MyMenu.prompt.foreground.
115
2018-09-16
omar.pol
.It Fl v
116
2018-09-16
omar.pol
Print version and exit.
117
2018-09-16
omar.pol
.It Fl W Ar val
118
2018-09-16
omar.pol
Override the width. Parsed as MyMenu.width.
119
2018-09-16
omar.pol
.It Fl x Ar val
120
2018-09-16
omar.pol
Override the positioning on the X axis, parsed as the resource MyMenu.x
121
2018-09-16
omar.pol
.It Fl y Ar val
122
2018-09-16
omar.pol
Override the positioning on the Y axis, parsed as the resource MyMenu.y
123
2018-06-07
omar.pol
.El
124
2018-05-18
omar.pol
.Sh RESOURCES
125
2018-05-18
omar.pol
.Bl -tag -width Ds
126
2018-05-18
omar.pol
.It MyMenu.font
127
2018-05-22
omar.pol
The font name to use. By default is set to "fixed" if compiled without
128
2018-05-22
omar.pol
Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
129
2018-05-22
omar.pol
are supported.
130
2018-05-19
omar.pol
.It MyMenu.layout
131
2018-05-19
omar.pol
The layout of the menu. The possible values are "horizontal" and
132
2018-05-19
omar.pol
"vertical", with the default being "horizontal". Every other value
133
2018-05-19
omar.pol
than "horizontal" is treated like "vertical", but this is kinda an
134
2018-05-19
omar.pol
implementation detail and not something to be relied on, since in the
135
2018-05-20
omar.pol
future other layout could be added as well.
136
2018-10-17
omar.pol
.It MyMenu.prompt
137
2018-05-20
omar.pol
A string that is rendered before the user input. Default to "$ ".
138
2018-10-17
omar.pol
.It MyMenu.prompt.border.size
139
2018-10-17
omar.pol
Parsed like MyMenu.border.size, but affects only the prompt. Default
140
2018-10-17
omar.pol
to 0.
141
2018-10-17
omar.pol
.It MyMenu.prompt.border.color
142
2018-10-17
omar.pol
Parsed like MyMenu.border.color, but affects only the prompt. Default
143
2018-10-17
omar.pol
to #000 (black).
144
2018-10-17
omar.pol
.It MyMenu.prompt.padding
145
2018-10-17
omar.pol
Parsed like MyMenu.border.size. The padding is the space between the
146
2018-10-17
omar.pol
end of the borderd and the start of the text, in any direction (top,
147
2018-10-17
omar.pol
bottom, left, right). Default to 10.
148
2018-05-18
omar.pol
.It MyMenu.width
149
2018-05-18
omar.pol
The width of the menu. If a numeric value is given (e.g. 400) is
150
2018-05-18
omar.pol
interpreted as pixel, if it ends with a percentage symbol `%'
151
2018-05-18
omar.pol
(e.g. 40%) the relative percentage will be computed (relative to the
152
2018-05-20
omar.pol
monitor width).
153
2018-05-18
omar.pol
.It MyMenu.height
154
2018-05-18
omar.pol
The height of the menu. Like MyMenu.width if a numeric value is given
155
2018-05-18
omar.pol
is interpreted as pixel, if it ends with a percentage symbol `%' the
156
2018-05-20
omar.pol
relative percentage will be computed (relative to the monitor height).
157
2018-05-18
omar.pol
.It MyMenu.x
158
2018-05-18
omar.pol
The X coordinate of the topmost left corner of the window. Much like
159
2018-05-18
omar.pol
MyMenu.height and MyMenu.width both a pixel dimension and percentage
160
2018-07-13
omar.pol
could be supplied. In addition to it, some special value can be used.
161
2018-07-13
omar.pol
.Bl -tag
162
2018-07-13
omar.pol
.It start
163
2018-07-13
omar.pol
Alias for 0;
164
2019-10-18
omar.pol
.It middle or center
165
2018-07-13
omar.pol
Compute the correct value to make sure that mymenu will be
166
2018-07-13
omar.pol
horizontally centered;
167
2018-07-13
omar.pol
.It end
168
2018-07-13
omar.pol
Compute the correct value to make sure that mymenu will be right
169
2018-07-13
omar.pol
aligned.
170
2019-10-20
omar.pol
.It mx and my
171
2019-10-20
omar.pol
These stands for x and y coordinate of the mouse respectively.
172
2018-07-13
omar.pol
.El
173
2018-05-18
omar.pol
.It MyMenu.y
174
2018-05-18
omar.pol
The Y coordinate of the topmost left corner of the window. Like the X
175
2018-05-26
omar.pol
coordinate a pixel dimension, percentage dimension or the special
176
2019-10-20
omar.pol
value "start", "middle"/"center", "end" or "mx"/"my" could be supplied.
177
2018-07-08
omar.pol
.It MyMenu.border.size
178
2018-07-08
omar.pol
A list of number separated by spaces to specify the border of the
179
2018-07-08
omar.pol
window. The field is parsed like some CSS properties (i.e. padding),
180
2018-07-08
omar.pol
that is: if only one value is provided then it'll be used for all
181
2018-07-08
omar.pol
borders; if two value are given than the first will be used for the
182
2018-07-08
omar.pol
top and bottom border and the former for the left and right border;
183
2018-07-08
omar.pol
with three value the first is used for the top border, the second for
184
2018-07-08
omar.pol
the left and right border and the third for the bottom border. If four
185
2018-07-08
omar.pol
value are given, they'll be applied to the respective border
186
2018-07-08
omar.pol
clockwise. Other values will be ignored. The default value is 0.
187
2018-10-17
omar.pol
188
2018-10-17
omar.pol
This particular option accepts a percentage (e.g. 10%) relative to the
189
2018-10-17
omar.pol
screen width.
190
2018-07-08
omar.pol
.It MyMenu.border.color
191
2018-07-08
omar.pol
A list of colors for the borders. This field is parsed like the
192
2018-07-08
omar.pol
MyMenu.border.size. The default value is black.
193
2018-05-18
omar.pol
.It MyMenu.prompt.background
194
2018-05-20
omar.pol
The background of the prompt.
195
2018-05-18
omar.pol
.It MyMenu.prompt.foreground
196
2018-05-20
omar.pol
The text color (foreground) of the prompt.
197
2018-05-18
omar.pol
.It MyMenu.completion.background
198
2018-05-20
omar.pol
The background of the completions.
199
2018-05-18
omar.pol
.It MyMenu.completion.foreground
200
2018-05-20
omar.pol
The text color of the completions.
201
2018-10-17
omar.pol
.It MyMenu.completion.border.size
202
2018-10-17
omar.pol
Parsed like MyMenu.border.size, but affects only the
203
2018-10-17
omar.pol
completion. Default to 0.
204
2018-10-17
omar.pol
.It MyMenu.completion.border.color
205
2018-10-17
omar.pol
Parsed like MyMenu.border.color, but affects only the
206
2018-10-17
omar.pol
completion. Default to #000 (black).
207
2018-10-17
omar.pol
.It MyMenu.completion.padding
208
2018-10-17
omar.pol
Parsed like MyMenu.prompt.padding. Default to 10.
209
2018-05-18
omar.pol
.It MyMenu.completion_highlighted.background
210
2018-05-20
omar.pol
The background of the selected completion.
211
2018-05-18
omar.pol
.It MyMenu.completion_highlighted.foreground
212
2018-05-20
omar.pol
The foreground of the selected completion.
213
2018-10-17
omar.pol
.It MyMenu.completion_highlighted.border.size
214
2018-10-17
omar.pol
Parsed like MyMenu.border.size, but affects only the completion
215
2018-10-17
omar.pol
highlighted. Default to 0.
216
2018-10-17
omar.pol
.It MyMenu.completion_highlighted.border.color
217
2018-10-17
omar.pol
Parsed like MyMenu.border.color, but affects only the completion
218
2018-10-17
omar.pol
highlighted. Default to #000 (black).
219
2018-10-17
omar.pol
.It MyMenu.completion_highlighted.padding
220
2018-10-17
omar.pol
Parsed like MyMenu.prompt.padding. Default to 10.
221
2018-05-18
omar.pol
.El
222
2018-09-16
omar.pol
.Sh COLORS
223
2018-09-16
omar.pol
MyMenu accept colors only in the form of:
224
2018-09-16
omar.pol
.Bl -bullet
225
2018-09-16
omar.pol
.It
226
2018-09-16
omar.pol
#rgb
227
2018-09-16
omar.pol
.It
228
2018-09-16
omar.pol
#rrggbb
229
2018-09-16
omar.pol
.It
230
2018-09-16
omar.pol
#aarrggbb
231
2018-09-16
omar.pol
.El
232
2018-05-18
omar.pol
233
2018-09-16
omar.pol
The opacity is assumed 0xff (no transparency) if not provided.
234
2018-05-18
omar.pol
.Sh KEYS
235
2018-07-01
omar.pol
This is the list of keybinding recognized by
236
2018-07-01
omar.pol
.Li Nm Ns .
237
2018-07-01
omar.pol
In the following examples, C-c means Control-c.
238
2018-05-18
omar.pol
.Bl -tag -width indent-two
239
2018-05-18
omar.pol
.It Esc
240
2018-05-18
omar.pol
Close the menu without selecting any entry
241
2018-07-01
omar.pol
.It C-c
242
2018-07-01
omar.pol
The same as Esc
243
2018-05-18
omar.pol
.It Enter
244
2018-05-18
omar.pol
Close the menu and print to stdout what the user typed
245
2018-05-19
omar.pol
.It C-m
246
2018-08-13
omar.pol
Confirm but keep looping (if enabled), otherwise complete only
247
2018-05-18
omar.pol
.It Tab
248
2018-05-18
omar.pol
Expand the prompt to the next possible completion
249
2018-05-18
omar.pol
.It Shift Tab
250
2018-05-18
omar.pol
Expand the prompt to the previous possible completion
251
2018-05-25
omar.pol
.It C-n
252
2018-05-25
omar.pol
The same as Tab
253
2018-05-25
omar.pol
.It C-p
254
2018-05-25
omar.pol
The same as Shift-Tab
255
2018-05-18
omar.pol
.It Backspace
256
2018-05-18
omar.pol
Delete the last character
257
2018-05-19
omar.pol
.It C-h
258
2018-05-19
omar.pol
The same as Backspace
259
2018-05-19
omar.pol
.It C-w
260
2018-05-19
omar.pol
Delete the last word
261
2018-05-19
omar.pol
.It C-u
262
2018-05-19
omar.pol
Delete the whole line
263
2018-07-06
omar.pol
.It C-i
264
2018-07-06
omar.pol
Toggle the ``first selected'' style. Sometimes, especially with the -a
265
2018-07-06
omar.pol
option, could be handy to disable that behaviour. Let's say that
266
2018-07-06
omar.pol
you've typed ``fire'' and the first completion is ``firefox'' but you
267
2018-07-06
omar.pol
really want to choose ``fire''. While you can type some spaces, this
268
2018-07-06
omar.pol
keybinding is a more elegant way to change, at runtime, the behaviour
269
2018-07-06
omar.pol
of the first completion.
270
2019-10-19
omar.pol
.It Button1
271
2019-10-20
omar.pol
Clicking on the prompt area closes mymenu, clicking on an item will
272
2019-10-20
omar.pol
confirm it.
273
2019-10-19
omar.pol
.It Button3
274
2019-10-20
omar.pol
Clicking on the prompt area closes mymenu, clicking on an item will
275
2019-10-20
omar.pol
confirm but keep looping (if enabled) the clicked item, like C-m
276
2019-10-19
omar.pol
.It Button4,Button5 / scroll
277
2019-10-19
omar.pol
Scroll through the completions (without changing the selection)
278
2018-05-18
omar.pol
.El
279
2018-07-21
omar.pol
.Sh EXIT STATUS
280
2018-07-21
omar.pol
0 when the user select an entry, 1 when the user press Esc, EX_USAGE
281
2018-07-21
omar.pol
if used with wrong flags and EX_UNAVAILABLE if the connection to X
282
2018-07-21
omar.pol
fails.
283
2018-07-21
omar.pol
.Sh EXAMPLES
284
2018-07-21
omar.pol
.Bl -bullet -bullet
285
2018-07-21
omar.pol
.It
286
2018-07-21
omar.pol
Create a simple menu with a couple of entry
287
2018-07-21
omar.pol
.Bd -literal -offset indent
288
2018-07-21
omar.pol
cat <<EOF | $SHELL -c "$(mymenu -p "Exec: ")"
289
2018-07-21
omar.pol
firefox
290
2018-07-21
omar.pol
zzz
291
2018-07-21
omar.pol
xcalc -stipple
292
2018-07-21
omar.pol
xlock
293
2018-07-21
omar.pol
gimp
294
2018-07-21
omar.pol
EOF
295
2018-07-21
omar.pol
.Ed
296
2018-07-21
omar.pol
.It
297
2018-07-21
omar.pol
Select and play a song from the current mpd playlist
298
2018-07-21
omar.pol
.Bd -literal -offset indent
299
2018-09-19
omar.pol
fmt="%position% %artist% - %title%"
300
2018-09-19
omar.pol
if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
301
2018-09-19
omar.pol
mpc play $(echo $song | sed "s/ .*$//")
302
2018-07-21
omar.pol
fi
303
2018-07-21
omar.pol
.Ed
304
2018-07-21
omar.pol
.El
305
2018-07-21
omar.pol
306
2018-07-21
omar.pol
.Sh SEE ALSO
307
2018-07-21
omar.pol
.Xr dmenu 1
308
2018-07-21
omar.pol
.Xr sysexits 3
309
2018-07-21
omar.pol
310
2018-07-21
omar.pol
.Sh AUTHORS
311
2018-07-21
omar.pol
.An Omar Polo <omar.polo@europecom.net>
312
2018-07-21
omar.pol
313
2018-08-13
omar.pol
.Sh CAVEATS
314
2018-05-18
omar.pol
.Bl -bullet
315
2018-05-18
omar.pol
.It
316
2018-05-18
omar.pol
If, instead of a numeric value, a not-valid number that terminates
317
2018-05-18
omar.pol
with the % sign is supplied, then the default value for that field
318
2018-05-18
omar.pol
will be treated as a percentage. Since this is a misuse of the
319
2018-05-18
omar.pol
resources this behavior isn't strictly considered a bug.
320
2018-05-22
omar.pol
.It
321
2018-07-13
omar.pol
Keep in mind that sometimes the order of the options matter. First are
322
2018-07-13
omar.pol
parsed (if any) the xrdb options, then the command line flags
323
2018-07-13
omar.pol
.Sy in the provided order!
324
2018-07-13
omar.pol
That meas that if you're providing first the x coordinate, let's say
325
2018-07-13
omar.pol
"middle", and
326
2018-07-13
omar.pol
.Sy after that
327
2018-07-13
omar.pol
you are overriding the width, the window
328
2018-07-13
omar.pol
.Sy will not be
329
2018-07-13
omar.pol
centered.
330
2018-07-13
omar.pol
331
2018-07-13
omar.pol
As a general rule of thumb, if you're overriding the width and/or the
332
2018-07-13
omar.pol
height of the window, remember to override the x and y coordinates as
333
2018-07-13
omar.pol
well.
334
2019-10-19
omar.pol
.It
335
2019-10-19
omar.pol
Clicking past the last item will be equivalent to clicking the last item.
336
2018-05-18
omar.pol
.El
Omar Polo