Debian Codegraph @

doc/fvwm-menu-desktop.adoc

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