aboutsummaryrefslogtreecommitdiff
path: root/doc/asciidoc/fluxbox-menu.txt
blob: f288ceff342b3203f408ca4f1b3bd0f08feb29aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
fluxbox-menu(5)
===============
Jim Ramsay <i.am@jimramsay.com>
v1.3.2, 28 October 2011
:man source:   fluxbox-menu.txt
:man version:  {revision}
:man manual:   Fluxbox Manual

NAME
----
fluxbox-menu - fluxbox(1) menu syntax

SYNOPSIS
--------
@pkgdatadir@/menu.lua

~/.fluxbox/menu.lua

~/.fluxbox/windowmenu.lua

SYNTAX
------
Variable parameters are shown in emphasis: 'argument'

All other characters shown are required verbatim. Whitespace is only required to
delimit words, but it is fine to add more whitespace.

DESCRIPTION
-----------
There are two types of menus in fluxbox which can be configured.

The first is the *ROOT MENU* (Or right-click menu), is usually bound to a
right-click on the desktop, though this binding can be changed in the `keys'
file (*fluxbox-keys(5)*). This same syntax is used for the *CustomMenu* command,
also mentioned in *fluxbox-keys(5)*.

Fluxbox installs a default root menu file in *@pkgdatadir@/menu.lua*. You can also
use fluxbox -i to confirm this location. Of course this system-wide menu can be
customized for all users at once, but it is also possible to create an
individual menu file for each user. By convention, users create a menu file in
*~/.fluxbox/menu.lua*. Once you've created your own menu file, you'll want to make
sure that you properly declare this location in your `init' file so that fluxbox
knows where to look. See *RESOURCES*, below for details.

The second type is the *WINDOW MENU*, which defines the contents of the menu
which appears when you right-click on a window's titlebar or iconbar. This opens
a menu file as defined by *~/.fluxbox/windowmenu.lua*. If this file does not exist,
fluxbox will copy in the default from *@pkgdatadir@/windowmenu.lua*.

You do not need to ``reload'' fluxbox after editing the menu file, the changes
should be taken into account the next time you open the menu.

ROOT MENU
---------
The root menu is a lua script. You can use all lua features to construct your
menu. Fluxbox is only interested in the return value of your script and will
never overwrite this file. Here, we will describe the simplest case of the menu
file, where you list the menu entries verbatim.

Menu is a lua table containing entries specifying the menu title and menu items.
The simplest menu.lua file looks like this:
....
return {
    type = "menu";
    title = "Fluxbox";
}
....
It contains two entries: *type*, which signals that this is indeed a menu and
*title*, which set's the title of the menu. It contains no menu items.

Menu entries are also tables, but with different value of the *type* field. To
add menu items to a menu, just list them (semicolon delimited) after all the
'key' *=* 'value' pairs.

To see all possible menu types, read the following sections. Besides the type,
all menu entries should contain the *label* field, which sets the text which is
displayed on the menu item. They may also contain the *encoding* field, which
specifies the encoding of the *label* field. You may enter the label in any
*iconv(1)* locale by specifying the appropriate encoding. If the *encoding*
field is empty, the value set in the parent menu is used.

Each menu entry may also contain an *icon* field. If specified, the icon
will be scaled down and displayed in the menu alongside the text label of the
item. It must be in .xpm or .png format.

Most entry types also expect a *param* field, which specifies additional
properties of the menu item. Some entry types may support additional fields.
These fields will be mentioned in the description of the particular menu type.

Standard lua comments are used: everything from *--* to the end of the line is
ignored. Block comments are enclosed in *--[[* and *]]*.

MENU ITEM TYPES
---------------

Special item types
~~~~~~~~~~~~~~~~~~

*separator*;;
	This will create a nice separation line. Useful for splitting up sections in
	a ``pretty'' way. The *label* field is ignored.

*nop*;;
	Insert a non-operational item into the current menu. This is much like
	*separator*, but instead of a line, it inserts a label. This can be used
	to help format the menu into blocks or sections if so desired. The label is
	optional, and if omitted a blank item will be inserted.

*menu*;;
        Inserts a submenu. The syntax is identical to that of the main menu. The
        *label* field sets the text in the parent menu, while *title* sets the
        title displayed at the top of the menu.

Actions
~~~~~~~
*exec*;;
	Inserts a command item into the menu. When you select the menu item from the
        menu, fluxbox runs the command set by the field *param* in your *$SHELL*
        (or /bin/sh if $SHELL is not
	set). You can use this to launch applications, run shell scripts, etc. Since
	all arguments are passed verbatim to the shell, you can use environment
	variables, pipes, or anything else the shell can do. Be sure to escape
        the special characters properly as the string will be parsed by lua
        'and' your shell. If you do not wan't lua to parse the string, quote the
        string using lua long brackets (*[[*'string'*]]*). Note that processes only
	see environment variables that were set before fluxbox started (such as in
	~/.fluxbox/startup).

*lua*;;
        Executes a lua code contained in *param* when the menu item is
        selected. The code can be given as a lua function, or a string, which
        will be compiled into a lua chunk. This function can then change fluxbox
        resources, modify keybindings, etc.

*command*;;
	Any legal keys file command may be used as a *param* and will be
        executed when this menu item is selected. See *fluxbox-keys(5)* for
        more information.

Fluxbox Functions
~~~~~~~~~~~~~~~~~
A number of special menu items may be used. These generally insert special menus
or menu items and have their own default labels which are used if you do not
specify one explicitly.

*config*;;
	Inserts a fluxbox native submenu item, containing numerous configuration
	options concerning window placement, focus style, window moving style, etc.
	See *Configuration Menu* in *fluxbox(1)* for details.

*exit*;;
	Inserts an item that shuts down and exits fluxbox. Any open windows are
	reparented to the root window before fluxbox exits.

*style*;;
	This tells fluxbox to insert an item that, when selected, reads style file
	specified by *param* and apply the new textures, colors and fonts to the current
	running session.

*stylesmenu*;;
        Reads all filenames from the specified directory specified by *param*,
        assuming that they are all
	valid style files, and creates inline menu items in the current menu for
	every filename, that, when selected by the user will apply the selected style
	file to the current session. The labels that are created in the menu are the
	filenames of the style files. *stylesmenu* makes it possible to install
        style files without editing your init file.

*wallpapers*;;
        This inserts a menu item to set the wallpaper for each file in the
        directory given by *param*. The command for setting the wallpaper is
        specified by the *program* field, and defaults to *fbsetbg*.

*workspaces*;;
	This tells fluxbox to insert a link to the workspaces menu directly into your
	menu. See *Workspace Menu* in *fluxbox(1)* for details.

Window operations
~~~~~~~~~~~~~~~~~
These items alter properties of the active window. They also provide a default
label if you don't put one.

*shade*;;
	Provides a menu item to shade or unshade (or, roll-up) the window. This is
	equivalent to the shade titlebar button.

*stick*;;
	Provides a menu item to stick or unstick the window. Stuck windows are
	displayed on all workspaces. This is equivalent to the stick titlebar button.

*maximize*;;
	Provides a menu item to maximize or unmaximize the window, equivalent to the
	maximize titlebar button. The button with which you click alters the
	behaviour of this item as follows:

	* Button 1  (Un)Maximize as normal.
	* Button 2  (Un)Maximize window vertically.
	* Button 3  (Un)Maximize window horizontally.

*iconify*;;
	Provides a menu item to iconify (or, minimize) the window, equivalent to the 
	iconify titlebar button.

*close*;;
	Closes the window gracefully, equivalent to the titlebar button.

*kill*;;
	Kills the window's process, like *xkill(1)*.

*raise*;;
	Raise the window to the top of the stack within its layer.

*lower*;;
	Lower the window to the bottom of the stack within its layer.

*settitledialog*;;
	Opens a dialog which can be used to set the window's title. Some applications
	may re-set their own title from time-to-time, wiping out your setting.

*sendto*;;
	Sends the window to a different workspace. When you select the workspace with
	a middle-click, fluxbox will also change to the new workspace. A regular
	click only sends the window.

*layer*;;
	Adds a ``Layer...'' submenu which lets you change the layer of this window.

*alpha*;;
	Adds a ``Transparency...'' submenu which lets you change the focused and
	unfocused transparency of this window.

*extramenus*;;
	Adds the ``Remember...'' menu item, which allows you to specify which
	settings should be stored in the `apps' file (See *fluxbox-apps(5)* for more
	details).

WINDOW MENU
-----------
The syntax the same as *ROOT MENU*, but the window menu usually contains only
the window operation menu items. However, there is nothing stopping you from
putting any other item there as well.

FILES
-----
*~/.fluxbox/menu.lua*::
	This is the default location for the user's root menu.
*@pkgdatadir@/menu.lua*::
	This is the system-wide root menu file. It will be used if the user's root
	menu is missing or unparseable.
*~/.fluxbox/windowmenu.lua*::
	This is the user's window menu definition file
*@pkgdatadir@/windowmenu.lua*::
	This is the default window menu. If the user does not have this file, it will
	be copied to *~/.fluxbox/windowmenu* on fluxbox startup.

RESOURCES
---------
*session.menuFile =* 'location'::
	This may be set to override the location of the user's root menu.

ENVIRONMENT
-----------
The 'comand...' field of the *[exec]* tag can take advantage of other
environment variables if they are set before fluxbox is started.

EXAMPLES
--------
.Root Menu
....
return {
    type = "menu";
    label = "fluxbox";
    { type = "exec"; label = "rxvt"; param = "rxvt -ls";
      icon = "/usr/X11R6/share/icons/terminal.xpm"; };
    { type = "exec"; label = "netscape"; param = "netscape -install"; };
    { type = "exec"; label = "The GIMP"; param = "gimp"; };
    { type = "exec"; label = "XV"; param = "xv"; };
    { type = "exec"; label = "Vim"; param = "rxvt -geometry 132x60 -name VIM -e screen vim"; };
    { type = "exec"; label = "Mutt"; param = "rxvt -name mutt -e mutt"; };
    {
        type = "menu";
        label = "mozilla";
        { type = "exec"; label = "browser"; param = "mozilla -browser"; };
        { type = "exec"; label = "news"; param = "mozilla -news"; };
        { type = "exec"; label = "mail"; param = "mozilla -mail"; };
        { type = "exec"; label = "edit"; param = "mozilla -edit"; };
        { type = "exec"; label = "compose"; param = "mozilla -compose"; };
    };
    {
        type = "menu";
        label = "Window Manager";
        { type = "exec"; label = "Edit Menus"; param = "nedit ~/.fluxbox/menu"; };
        {
            type = "menu";
            label = "Style";
            title = "Which Style?";
            { type = "stylesdir"; param = "~/.fluxbox/styles"; };
            { type = "stylesdir"; param = "@pkgdatadir@/styles"; };
        };
        { type = "config"; label = "Config Options"; };
        { type = "command"; label = "Reconfigure"; param = "reconfig"; };
        { type = "command"; label = "Restart"; param = "restart"; };
    };
    { type = "exit"; label = "Log Out"; };
};
....

.Default Window Menu
....
return {
    type = "menu";

    { type = "shade" };
    { type = "stick" };
    { type = "maximize" };
    { type = "iconify" };
    { type = "raise" };
    { type = "lower" };
    { type = "settitledialog" };
    { type = "sendto" };
    { type = "layer" };
    { type = "alpha" };
    { type = "extramenus" };
    { type = "separator" };
    { type = "close" };
};
....

AUTHORS
-------
- Jim Ramsay <i.am at jimramsay com> (>fluxbox-1.0.0)
- Curt Micol <asenchi at asenchi com> (>fluxbox-0.9.11)
- Tobias Klausmann <klausman at users sourceforge net> (<=fluxbox-0.9.11)
- Grubert <grubert at users sourceforge net> (fluxbox)
- Matthew Hawkins <matt at mh dropbear id au> (blackbox)
- Wilbert Berendsen <wbsoft at xs4all nl> (blackbox)

SEE ALSO
--------
fluxbox(1) fluxbox-keys(5) fluxbox-apps(5) xkill(1) iconv(1)