@@ -17,7 +17,6 @@ XMenu understand the following command-line options.
17
17
18
18
* ` -N name ` : Specify a resource/instance name for XMenu.
19
19
* ` -p position ` : Specify a position to place XMenu.
20
- * ` -t ` : Enable menus to be torn off.
21
20
* ` -w ` : Initiate XMenu as a regular window.
22
21
23
22
## Environment
@@ -50,6 +49,8 @@ Reboot reboot
50
49
51
50
![ demo] ( ./demo.png )
52
51
52
+ An example script can be found at ` ./examples/xmenu.sh ` .
53
+
53
54
## Customization
54
55
XMenu can be customized by setting the following X resources before
55
56
invoking XMenu.
@@ -68,17 +69,21 @@ invoking XMenu.
68
69
* ` XMenu.opacity ` : Background opacity (from 0.0 to 1.0).
69
70
* ` XMenu.separatorColor ` : Separator color.
70
71
* ` XMenu.shadowThickness ` : 3D relief size.
72
+ * ` XMenu.tearOff ` : Enable menus to be torn off.
71
73
* ` XMenu.topShadowColor ` , ` XMenu.middleShadowColor ` , ` XMenu.bottomShadowColor ` :
72
74
Colors of the 3D relief.
73
75
76
+ An example style configurationcanbe found at ` ./examples/Xresources ` .
77
+
74
78
## Installation
75
79
Run ` make all ` to build, and ` make install ` to install the binary and
76
80
the manual into ` ${PREFIX} ` (` /usr/local ` ).
77
81
78
- ## Usage
82
+ ## Features
79
83
80
84
* XMenu reads something in and prints something out, the UNIX way.
81
85
* Submenus (some menu entries can spawn another menu).
86
+ * Torn off menus (menus can be managed by the window manager like a regular window).
82
87
* Separators (menu entries can be separated by a line).
83
88
* Icons (menu entries can be preceded by an icon image).
84
89
* X resources support (you don't need to recompile xmenu for configuring it).
@@ -88,5 +93,207 @@ the manual into `${PREFIX}` (`/usr/local`).
88
93
The code and manual are under the MIT/X license.
89
94
See ` ./LICENSE ` for more information.
90
95
91
- ## Epilogue
92
- ** Read the manual.**
96
+ ## Manual
97
+
98
+ XMENU(1) General Commands Manual XMENU(1)
99
+
100
+ NAME
101
+ xmenu - menu utility for X
102
+
103
+ SYNOPSIS
104
+ xmenu [-w] [-N name] [-p position] [title]
105
+
106
+ DESCRIPTION
107
+ xmenu is a menu for X. It reads a list of newline-separateditems from
108
+ standard input; shows a menu for the user to select one of the items; and
109
+ writes the selected item into standard output.
110
+
111
+ The options are as follows:
112
+
113
+ -N name
114
+ Specifiy the res_name member of the XClassHint(3) property. Ar
115
+ name is used to retrieve resources. If not specified, defaults
116
+ to the command that xmenu was invoked as (that is, the
117
+ basename(3) of its argv[0]).
118
+
119
+ -p position
120
+ Set the position to spawn xmenu. Without this option, xmenu
121
+ spawns next to the cursor. Position is a string of the form
122
+ GEOMETRY[:MONITOR], where GEOMETRY is a geometry parsed by
123
+ XParseGeometry(3). MONITOR is the number of the monitor the
124
+ geometry is relative to (counting from 0); it can instead be a
125
+ string like "current" or "cursor", specifyingthe monitor where
126
+ the cursor is on.
127
+
128
+ -w Asks the window manager to draw a border around the menu. This
129
+ makes xmenu start torn off.
130
+
131
+ Each item read from standard input has the following format (bracket
132
+ groups optional elements):
133
+
134
+ [TABS] [IMAGE TABS] LABEL [TABS OUTPUT] NEWLINE
135
+ or
136
+
137
+ [TABS] [:] NEWLINE
138
+
139
+ The components are as follows:
140
+
141
+ o The initial tabs indicate the menu hierarchy: items indented with a
142
+ tab are placed in a submenu of the preceding item not indented. An
143
+ item without initial tabs is a top-level item.
144
+
145
+ o The image is a string of the form "IMG:/path/to/image.png". It
146
+ specifies the path to an image file to be shown as icon at the left
147
+ of the entry. If the path does not begin with "/", "./", or "../",
148
+ the file is searched on the paths specified in the ICONPATH
149
+ environment variable.
150
+
151
+ o The label is the string that will be shown as an item in the menu.
152
+ An item without label or with a single colon (:) as label is
153
+ considered a separator and is drawn as a thin line in the menu
154
+ separating the item above from the item below.
155
+
156
+ o The output is the string that will be output after selecting the
157
+ item. If an item does not have tabs after the label, its label is
158
+ used as its output. If the output is empty or is a colon (:), the
159
+ item cannot be selected.
160
+
161
+ o The newline terminates the item specification.
162
+
163
+ If the argument title is given, the title of the menu window is set to
164
+ it.
165
+
166
+ USAGE
167
+ xmenu is controlled by the mouse, but can also be controlled by the
168
+ keyboard. Items can be selected using the arrow keys. Tab (with and
169
+ without Shift), Home, End, Enter and Esc, and 1-9 keys. Itams can also
170
+ be selected by typing the first several characters in it.
171
+
172
+ Down Cycle through the items in the regular direction.
173
+
174
+ End Selects the last item in the menu.
175
+
176
+ Esc Go to the menu above in the hierarchy or exit xmenu.
177
+
178
+ Home Selects the first item in the menu.
179
+
180
+ Left Go to the menu above in the hierarchy.
181
+
182
+ Right, Enter
183
+ Select the highlighted item.
184
+
185
+ Shift-Tab
186
+ Cycle through the items in the reverse direction. When the type-
187
+ to-select feature is active, cycle through matching items
188
+ instead.
189
+
190
+ Tab Cycle through the items in the regular direction. When the type-
191
+ to-select feature is active, cycle through matching items
192
+ instead.
193
+
194
+ Up Cycle through the items in the reverse direction.
195
+
196
+ Additional key bindings can be set at compile time by changing the
197
+ config.h file.
198
+
199
+ RESOURCES
200
+ xmenu understands the following X resources. They must be prefixed with
201
+ either the "XMenu" class, or the name given with the -N command-line
202
+ option, followed by a period.
203
+
204
+ activeBackground
205
+ The backround color of selected items in the menu.
206
+
207
+ activeForeground
208
+ The color of the label text of selected items in the menu.
209
+
210
+ alignment
211
+ If set to "left", "center", or "right", text is aligned to the
212
+ left, center, or right of the menu, respectively. By default,
213
+ text is aligned to the left.
214
+
215
+ background
216
+ The background color of non-selected items in the menu.
217
+
218
+ borderColor
219
+ The color of the border around the menu.
220
+
221
+ borderWidth
222
+ The size in pixels of the border around the menu.
223
+
224
+ faceName
225
+ Font for drawing text. If the value is prefixed with "xft:"
226
+ (case insensitive), then xmenu uses the Xft(3) library for
227
+ drawing text; and fallback fonts can be specified by delimiting
228
+ the fonts with commas. If the value is prefixed with "x:" or
229
+ "x11:" (case insensitive), then xmenu uses the X11 library for
230
+ drawing text.
231
+
232
+ faceSize
233
+ The size, in points of the font. This only affects Xft(3) fonts.
234
+
235
+ foreground
236
+ The color of the label text of non-selected items in the menu.
237
+
238
+ gap The gap, in pixels, between the menus.
239
+
240
+ maxItems
241
+ Maximum number of items to be displayed in a menu. If a menu has
242
+ more than this number of items, they will be scrolled with arrow
243
+ buttons.
244
+
245
+ opacity
246
+ Background opacity as a floating point number between 0.0 and 1.0
247
+ inclusive.
248
+
249
+ separatorColor
250
+ The color of the separator between items in the menu.
251
+
252
+ shadowThickness
253
+ The size in pixels of the Motif-like 3D relief.
254
+
255
+ tearOff
256
+ If set to "True", "On", or "Enable", creates a dashed line on the
257
+ top of each non-windowed menu to tear them off into a new
258
+ windowed menu.
259
+
260
+ topShadowColor, middleShadowColor, bottomShadowColor
261
+ The color of the top/light, middle and bottom/dark parts of the
262
+ Motif-like 3D relief. Setting these resources override
263
+ background and separateColor.
264
+
265
+ ENVIRONMENT
266
+ The following environment variables affect the execution of xmenu.
267
+
268
+ DISPLAY
269
+ The display to start xmenu on.
270
+
271
+ ICONPATH
272
+ A colon-separated list of directories used to search for the
273
+ location of image files.
274
+
275
+ EXAMPLES
276
+ The following script illustrates the use of xmenu. The output is
277
+ redirected to sh(1), creating a command to be run by the shell.
278
+
279
+ $!/bin/sh
280
+
281
+ xmenu <<EOF | sh &
282
+ Applications
283
+ IMG:./web.png Web Browser firefox
284
+ IMG:./gimp.png Image Editor gimp
285
+ Terminal (xterm) xterm
286
+ Terminal (urxvt) urxvt
287
+ Terminal (st) st
288
+
289
+ Shutdown poweroff
290
+ Reboot reboot
291
+ EOF
292
+
293
+ For example, by selecting "Applications", a new menu will appear.
294
+ Selecting "Web Browser" in the new menu opens firefox.
295
+
296
+ SEE ALSO
297
+ xclickroot(1), X(7)
298
+
299
+ UNIX July 9, 2023 UNIX
0 commit comments