Debian Codegraph @

doc/fvwm-menu-desktop.adoc

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 = fvwm-menu-desktop(1)
2
3 == NAME
4
5 fvwm-menu-desktop - Reads XDG menu files and creates Fvwm menus
6
7 == SYNOPSIS
8
9 fvwm-menu-desktop [ *--help*|*-h* ] [ *--version* ] [
10 *--install-prefix* _DIR_ ] [ *--desktop* _NAME_ ] [ *--menu-type* _NAME_
11 ] [ *--theme* _NAME_ ] [ *--with-titles*|*-w* ] [ *--without-titles* ]
12 [ *--enable-mini-icons* ] [ *--size*|*-s* _NUM_ ] [ *--mini-icon-dir*
13 _DIR_ ] [ *--app-icon* _NAME_ ] [ *--dir-icon* _NAME_ ] [
14 *--title*|*-t* _NAME_ ] [ *--insert-in-menu* _NAME_ ] [ *--get-menus*
15 _all_|_desktop_ ] [ *--set-menus* _menu_paths_ ] [ *--all-menus* ] [
16 *--include-items* _NAME_ ] [ *--regen-cmd* _CMD_ ] [ *--term-cmd* _CMD_
17 ] [ *--dynamic* ] [ *--menu-error*|*-e* ] [ *--verbose*|*-v* ]
18
19 == DESCRIPTION
20
21 This is a python script which parses XDG menus definitions to build
22 corresponding fvwm menus. This script depends on python-xdg to run.
23
24 == MAIN OPTIONS
25
26 *--help*::
27 Show the help and exit.
28 *--version*::
29 Show the version and exit.
30 *--get-menus* _all_|_desktop_::
31 Prints a space separated list of full menu paths found on the system.
32 _all_ will print all menus found on the system except empty ones.
33 _desktop_ will print the menu(s) that would be generated by the
34 script.
35 +
36 No menu generation is done.
37
38 *--desktop* _NAME_::
39 Optional parameter to set the _NAME_ of the desktop XDG .menu file(s)
40 to use. This option will override any default menus set via
41 *FvwmForm-XDGMenu-Config* and cause the script to find menus in which
42 _NAME_ is a part of the file name. Possible names are: _gnome_, _kde_,
43 _xfce_, _lxde_, _debian_, etc.
44 +
45 This option can be used in conjunction with *--menu-type* to control
46 which .menu file(s) are used.
47
48 *--menu-type* _NAME_::
49 Optional parameter to set the _NAME_ of the XDG menu type to use. This
50 option will override any default menus set via
51 *FvwmForm-XDGMenu-Config* and cause the script to find menus in which
52 _NAME_ is a part of the file name. Possible _NAME_ types could be:
53 _applications_, _settings_, _preferences_, etc.
54 +
55 When used in conjunction with *--desktop*, only menus whose file name
56 matches '*destkop*menutype*' are found. If no menus are found, the
57 script exits with an error.
58
59 *--all-menus*::
60 This option will build all menus found on the system. If used in
61 conjunction with *--desktop* or *--menu-type* this will build all
62 menus matching those settings.
63 *--install-prefix* _DIR_::
64 Optional parameter to override the standard locations for XDG menu
65 definitions. Tells *fvwm-menu-desktop* to look in _DIR_ for .menu
66 files instead of the standard locations /etc/xdg/menus (and
67 $HOME/.config/menus if it exists).
68 *--with-titles*|*-w*::
69 If this option is set menus are generated with titles. This is the
70 default. This option can be used to override the
71 *FvwmForm-XDGMenu-Config* default setting.
72 *--without-titles*::
73 If this option is set menus are generated without titles. The default
74 is to generate with titles.
75 *--title*|*-t* _NAME_::
76 Option to define the menu title _NAME_ of the top menu used by Fvwm's
77 *Menu* or *Popup* commands. Default is "XDGMenu".
78 *--include-items* _NAME_::
79 This option controls if the additional menu items 'Regenerate' and
80 'Configure' are included in the top level menu. _NAME_ can be one of
81 _regenerate_, _config_, _both_, or _none_. The default is _both_.
82 *--regen-cmd* _CMD_::
83 This option sets the fvwm command _CMD_ that is run when the menu item
84 'Regenerate' is selected. The default is "PipeRead
85 `fvwm-menu-desktop`".
86 *--term-cmd* _CMD_::
87 This option sets the terminal emulator command _CMD_ that is used to
88 to run terminal applications in. _CMD_ needs to end with an execute
89 option, such as xterm's -e option, which will run the command that is
90 appended to _CMD_. The default is "xterm -e".
91 +
92 Debian specific: Per Debian policy, default changed to
93 "x-terminal-emulator -e".
94 +
95 *--dynamic*::
96 This option is to be used with creating dynamic menus using
97 *DynamicPopUpAction* and *DynamicPopDownAction*. This adds a
98 'recreate' to the *DestroyMenu* command on the top level menu so those
99 actions are not Destroyed when the menu is regenerated.
100 *--insert-in-menu* _NAME_::
101 Option to insert generated menu(s) *IN* a menu _NAME_ (its top title).
102 This option makes it so the top level menu is not Destroyed and the
103 items are added to the end.
104 +
105 Note menus regenerated with this option will append the menu items at
106 the end of the existing menu. Each time the menu is regenerated new menu
107 items appear giving a growing menu of duplicate items. You have to
108 regenerate the whole menu via a function or restart fvwm. See *EXAMPLES*
109 below for some solutions.
110
111 *--set-menus* _menu_paths_::
112 Generates all menus listed in a space separated list of full menu
113 paths. This option overrides any defaults and
114 **--desktop**|*--menu-type* settings.
115 *--menu-error*|*-e*::
116 If this option is present and python-xdg is not found, the script will
117 print the error in the generated menu. Used in the default-config.
118 *--verbose*::
119 Enables additional information printouts on STDERR.
120
121 == ICONS OPTIONS
122
123 By default, fvwm-menu-desktop builds menus without mini-icons. To
124 enable mini-icons use the following options.
125
126 If ImageMagick is installed on the system, the script will resize and
127 copy the icons to $FVWM_USERDIR/.icons. This can take awhile. You should
128 be prepared to wait the first time you generate the icons. Once the
129 icons have been generated the script should run faster. If it is still
130 to slow using icons, see *EXAMPLES* for ways to limit how often the menu
131 is generated to speed things up.
132
133 *--enable-mini-icons*::
134 This option enables mini-icons in the menus. If set, 24x24 mini-icons
135 are used. If the specified icon isn't that size it will be converted
136 if *ImageMagick* is installed and saved in $HOME/.fvwm/icons or to the
137 directory specified with --mini-icon-dir option. Otherwise no icon
138 appears in the menu for that entry. With most distributions, all the
139 menu entries will have mini-icons appropriate to the application.
140 *--theme* _NAME_::
141 Defines the used icon theme. Default is _gnome_ but all others found
142 in /usr/share/icons could be used except the _hicolor_ theme because
143 it's the default fallback theme if no icon is found.
144 *--size*|*-s* _NUM_::
145 If --enable-mini-icons is used the _size_ of the icons can changed
146 with this parameter. Default is 24.
147 *--mini-icon-dir* _DIR_::
148 When the right size mini-icon isn't available, fvwm-menu-desktop
149 creates icons with the right size in $HOME/.fvwm/icons. If you don't
150 want to use the default directory, $HOME/.fvwm/icons, use this option
151 to specify a different folder.
152 *--app-icon* _NAME_::
153 Sets the default application icon if no others are found. Default is
154 'gnome-applications'.
155 *--dir-icon* _NAME_::
156 Sets the default directory icon if no others are found. Default is
157 'gnome-fs-directory'.
158
159 == USAGE
160
161 *fvwm-menu-desktop* outputs XDG .menu files in the syntax of fvwm menus.
162 When *fvwm-menu-desktop* is run with no options, it will load defaults
163 from the *FvwmForm-XDGMenu-Config* file (see below) then search your
164 system for suitable menu file(s). To see which menus are available on
165 your system run:
166
167 ....
168 fvwm-menu-desktop --get-menus all
169 ....
170
171 If no menus are found you may not have any installed on your system. By
172 default menus are stored as *.menu files in /etc/xdg/menus,
173 $HOME/.config/menus or the location set in $XDG_MENU_PREFIX. You can use
174 *--install-prefix* to specify another location search for menus.
175
176 Though a combination of command line options and the
177 *FvwmForm-XDGMenu-Config* settings, *fvwm-menu-desktop* can generate any
178 combination of the menus found. To get a list of what menu(s) would be
179 generated use the *--get-menus* _desktop_ option. The following will
180 list all menus generated if *fvwm-menu-desktop* was run with no options.
181
182 ....
183 fvwm-menu-desktop --get-menus desktop
184 ....
185
186 *fvwm-menu-desktop* determines which menu(s) to generate as follows
187
188 If no config file is found, all menus will be weighted and the script
189 will generate the best (highest weight) menu found.
190
191 If a config file is found (and override options are not used) the script
192 will generate all menus selected in *FvwmForm-XDGMenu-Config*.
193
194 *--desktop*, *--menu-type*, *--set-menus* and *--all-menus* will
195 override any menus selected in *FvwmForm-XDGMenu-Config*.
196
197 *--desktop* and *--menu-type* will only include menus whose name matches
198 '*desktop*menutype*'. If used with *--all-menus*, all matching menus are
199 generated. If used without *--all-menus*, only the highest weighted menu
200 is generated.
201
202 *--set-menus* generates menus from the list of full path menu file
203 names.
204
205 *--all-menus* by itself will generate all menus found.
206
207 By default *fvwm-menu-desktop* will generate a menu whose top level name
208 is "XDGMenu". To tell fvwm to read the output of *fvwm-menu-desktop* to
209 create the menu XDGMenu add the following to your fvwm config file:
210
211 ....
212 PipeRead 'fvwm-menu-desktop'
213 ....
214
215 *Warning:* Depending on the options used this command may be slow and
216 fvwm will pause until this command is complete. See *EXAMPLES* below for
217 more details and possible workarounds.
218
219 Once the menu is generated you can open the menu by using the command
220 "Menu XDGMenu". You can also include this in the MenuFvwmRoot menu by:
221
222 ....
223 AddToMenu MenuFvwmRoot "XDG Menu" Popup XDGMenu
224 ....
225
226 *fvwm-menu-desktop* can be configured though both command line options
227 and a *FvwmForm* GUI to customize the menu(s) that get generated.
228
229 == GUI
230
231 *FvwmForm-XDGMenu-Config* is a *FvwmForm* interface that can be used to
232 configure the defaults for *fvwm-menu-desktop*. You can access this from
233 the "Configure" item in the top level menu that is generated or run the
234 following from within *FvwmCommand* or *FvwmPrompt*:
235
236 ....
237 Module FvwmPerl -l fvwm-menu-desktop-config.fpl
238 ....
239
240 This form can be used to select which menu(s) get generated by default
241 along with setting many (but not all) of the available options. When you
242 click "Save Settings" the form will write a config file located at
243 $FVWM_USERDIR/.FvwmForm-XDGMenu-Config that *fvwm-menu-desktop* will
244 parse for defaults when run.
245
246 See the help inside of *FvwmForm-XDGMenu-Config* for more information.
247
248 == EXAMPLES
249
250 There are many ways to setup when fvwm runs *fvwm-menu-desktop* to
251 generate the menu. One method is to just generate the menu when fvwm
252 loads and then use the GUI config tool to change any options. To do this
253 you only need to add the following to the fvwm config file:
254
255 ....
256 AddToMenu MenuFvwmRoot "XDG Menu" Popup XDGMenu PipeRead
257 'fvwm-menu-desktop'
258 ....
259
260 The menu is created once when fvwm loads. Since menu creation can
261 sometimes be slow, this could cause fvwm to take longer to load than one
262 wants.
263
264 The menu is only generated when fvwm starts. If software is installed or
265 removed you will have to select the 'Regenerate' option to rebuild the
266 menu.
267
268 One way to speed things up is to save the menu in a file and only
269 generate the menu when 'Regenerate' is selected. To do this use
270 *--regen-cmd* to call a custom function and write the menu to a file
271 using a command like
272
273 ....
274 fvwm-menu-desktop --regen-cmd XDGRegen > $FVWM_USERDIR/.XDGMenu
275 ....
276
277 Then add the following to the fvwm config file to define the function
278 XDGRegen. The second to last line will generate the menu if the menu
279 file doesn't exist when fvwm starts.
280
281 ....
282 DestroyFunc XDGRegen
283 AddToFunc XDGRegen
284 + I PipeRead 'fvwm-menu-desktop --regen-cmd XDGRegen > \
285 $[FVWM_USERDIR]/.XDGMenu; echo "Nop"'
286 + I Read $[FVWM_USERDIR]/.XDGMenu
287
288 Test (!f $[FVWM_USERDIR]/.XDGMenu) XDGRegen Read $[FVWM_USERDIR]/.XDGMenu
289 ....
290
291 Besides creating a top level menu, *fvwm-menu-desktop* can insert the
292 menu into an existing menu using the *--insert-in-menu* option. For
293 example one could create the menu MenuFvwmRoot and include the XDG items
294 at the end.
295
296 ....
297 DestroyMenu MenuFvwmRoot
298 AddToMenu MenuFvwmRoot "Fvwm" Title
299 + "Item1" Action1 ...
300 + "ItemN" ActionN
301 + "" Nop
302
303 PipeRead 'fvwm-menu-desktop --insert-in-menu MenuFvwmRoot'
304 ....
305
306 In this case the menu items are inserted at the end of the MenuFvwmRoot
307 menu. If no items are in the menu, this menu becomes MenuFvwmRoot. The
308 problem here is, that you have to restart fvwm or rebuild the whole menu
309 to Regenerate it because menu items cannot be removed. To do this you
310 could use a function like
311
312 ....
313 DestroyFunc XDGRegen
314 AddToFunc XDGRegen
315 + I DestroyMenu MenuFvwmRoot
316 + I AddToMenu MenuFvwmRoot "Fvwm" Title
317 + I AddToMenu MenuFvwmRoot "Item1" Action1 ...
318 + I AddToMenu MenuFvwmRoot "ItemN" ActionN
319 + I AddToMenu MenuFvwmRoot "" Nop
320 + I PipeRead 'fvwm-menu-desktop --insert-in-menu MenuFvwmRoot \
321 --regen-cmd XDGRegen'
322 ....
323
324 Fvwm can also create menus dynamically by using *DynamicPopUpAction*
325 and/or *DynamicPopDownAction*. These commands when used with a Menu will
326 run a Function when the menu is opened. For example one could create the
327 menu XDGMenu when it is opened using
328
329 ....
330 AddToMenu XDGMenu "XDGMenu" Title
331 + DynamicPopUpAction PipeRead 'fvwm-menu-desktop'
332 ....
333
334 This will create the menu when it is opened. One issue here is it will
335 only create the menu the first time it is opened, and you still have to
336 Regenerate the menu to see any changes. To create the menu each time it
337 is open used the *--dynamic* option
338
339 ....
340 AddToMenu XDGMenu "XDGMenu" Title
341 + DynamicPopUpAction PipeRead 'fvwm-menu-desktop \
342 --dynamic --include-items config'
343 + DynamicPopDownAction DestroyMenu recreate XDGMenu
344 ....
345
346 This will now Destroy the menu when it closed so it can be rebuilt the
347 next time it is opened. The recreate flag doesn't completely destroy the
348 menu keeping the DynamicPopUpAction and DynamicPopDownAction actions.
349 The *--dynamic* flag includes the recreate option in the generated
350 menus.
351
352 To insert a menu into MenuFvwmRoot and still be dynamic you need to use
353 a function that generates the whole menu. For example
354
355 ....
356 DestroyFunc GenRootMenu
357 AddToFunc GenRootMenu
358 + I DestroyMenu recreate MenuFvwmRoot
359 + I AddToMenu MenuFvwmRoot "Fvwm" Title
360 + I AddToMenu MenuFvwmRoot "Item1" Action1 ...
361 + I AddToMenu MenuFvwmRoot "ItemN" ActionN
362 + I AddToMenu MenuFvwmRoot "" Nop
363 + PipeRead `fvwm-menu-desktop --insert-in-menu MenuFvwmRoot \
364 --include-items config`
365
366 AddToMenu MenuFvwmRoot "Fvwm" Title
367 + DynamicPopUpAction GenRootMenu
368 + DynamicPopDownAction DestroyMenu recreate MenuFvwmRoot
369 ....
370
371 == BUGS
372
373 The whole process of creating menus from files is slow. Otherwise report
374 bugs to the fvwm-workers mailing list <[email protected]>.
375
376 == AUTHORS
377
378 This script is based on fvwm-xdg-menu.py written by Piotr Zielinski
379 (http://www.cl.cam.ac.uk/~pz215/) who assigned Licence: GPL 2 Date:
380 03.12.2005.
381
382 The script was reworked to replace the existing fvwm-menu-desktop perl
383 script by the fvwm-workers.
384
385 == COPYING
386
387 The script is distributed by the same terms as fvwm itself. See GNU
388 General Public License for details.