.\" t .\" @(#)fvwm-2.6.8 06 November 2016 .de EX \"Begin example .ne 5 .if n .sp 1 .if t .sp .5 .nf .in +.5i .. .de EE .fi .in -.5i .if n .sp 1 .if t .sp .5 .. .ta .3i .6i .9i 1.2i 1.5i 1.8i .TH fvwm-menu-desktop 1 "06 November 2016 (2.6.8)" Fvwm "Fvwm Modules" .UC .SH NAME fvwm-menu-desktop \- Reads XDG menu files and creates Fvwm menus .SH SYNOPSIS fvwm-menu-desktop [ \fB\-\-help\fR|\fB\-h\fR ] [ \fB\-\-version\fR ] [ \fB\-\-install\-prefix\fR \fIDIR\fR ] [ \fB\-\-desktop\fR \fINAME\fR ] [ \fB\-\-menu\-type\fR \fINAME\fR ] [ \fB\-\-theme\fR \fINAME\fR ] [ \fB\-\-with\-titles\fR|\fB\-w\fR ] [ \fB\-\-without\-titles\fR ] [ \fB\-\-enable\-mini\-icons\fR ] [ \fB\-\-size\fR|\fB\-s\fR \fINUM\fR ] [ \fB\-\-mini\-icon\-dir\fR \fIDIR\fR ] [ \fB\-\-app\-icon\fR \fINAME\fR ] [ \fB\-\-dir\-icon\fR \fINAME\fR ] [ \fB\-\-title\fR|\fB\-t\fR \fINAME\fR ] [ \fB\-\-insert\-in\-menu\fR \fINAME\fR ] [ \fB\-\-get\-menus\fR \fIall\fR|\fIdesktop\fR ] [ \fB\-\-set\-menus\fR \fImenu_paths\fR ] [ \fB\-\-all\-menus\fR ] [ \fB\-\-include\-items\fR \fINAME\fR ] [ \fB\-\-regen\-cmd\fR \fICMD\fR ] [ \fB\-\-term\-cmd\fR \fICMD\fR ] [ \fB\-\-dynamic\fR ] [ \fB\-\-menu-error\fR|\fB\-e\fR ] [ \fB\-\-verbose\fR|\fB\-v\fR ] .SH DESCRIPTION This is a python script which parses XDG menus definitions to build corresponding fvwm menus. This script depends on python-xdg to run. .SH OPTIONS .IP "Main Options" .IP "\fB\-\-help\fR" Show the help and exit. .IP "\fB\-\-version\fR" Show the version and exit. .IP "\fB\-\-get\-menus\fR \fIall\fR|\fIdesktop\fR" Prints a space separated list of full menu paths found on the system. \fIall\fR will print all menus found on the system except empty ones. \fIdesktop\fR will print the menu(s) that would be generated by the script. No menu generation is done. .IP "\fB\-\-desktop\fR \fINAME\fR" Optional parameter to set the \fINAME\fR of the desktop XDG .menu file(s) to use. This option will override any default menus set via \fBFvwmForm-XDGMenu-Config\fR and cause the script to find menus in which \fINAME\fR is a part of the file name. Possible names are: \fIgnome\fR, \fIkde\fR, \fIxfce\fR, \fIlxde\fR, \fIdebian\fR, etc. This option can be used in conjunction with \fB\-\-menu\-type\fR to control which .menu file(s) are used. .IP "\fB\-\-menu\-type\fR \fINAME\fR" Optional parameter to set the \fINAME\fR of the XDG menu type to use. This option will override any default menus set via \fBFvwmForm-XDGMenu-Config\fR and cause the script to find menus in which \fINAME\fR is a part of the file name. Possible \fINAME\fR types could be: \fIapplications\fR, \fIsettings\fR, \fIpreferences\fR, etc. When used in conjunction with \fB\-\-desktop\fR, only menus whose file name matches '*destkop*menutype*' are found. If no menus are found, the script exits with an error. .IP "\fB\-\-all\-menus\fR" This option will build all menus found on the system. If used in conjunction with \fB\-\-desktop\fR or \fB\-\-menu\-type\fR this will build all menus matching those settings. .IP "\fB\-\-install-prefix\fR \fIDIR\fR" Optional parameter to override the standard locations for XDG menu definitions. Tells \fBfvwm-menu-desktop\fR to look in \fIDIR\fR for .menu files instead of the standard locations /etc/xdg/menus (and $HOME/.config/menus if it exists). .IP "\fB\-\-with\-titles\fR|\fB\-w\fR" If this option is set menus are generated with titles. This is the default. This option can be used to override the \fBFvwmForm-XDGMenu-Config\fR default setting. .IP "\fB\-\-without\-titles\fR" If this option is set menus are generated without titles. The default is to generate with titles. .IP "\fB\-\-title\fR|\fB\-t\fR \fINAME\fR " Option to define the menu title \fINAME\fR of the top menu used by Fvwm's \fBMenu\fR or \fBPopup\fR commands. Default is "XDGMenu". .IP "\fB\-\-include\-items\fR \fINAME\fR " This option controls if the additional menu items 'Regenerate' and 'Configure' are included in the top level menu. \fINAME\fR can be one of \fIregenerate\fR, \fIconfig\fR, \fIboth\fR, or \fInone\fR. The default is \fIboth\fR. .IP "\fB\-\-regen\-cmd\fR \fICMD\fR " This option sets the fvwm command \fICMD\fR that is run when the menu item \'Regenerate' is selected. The default is "PipeRead `fvwm-menu-desktop`". .IP "\fB\-\-term\-cmd\fR \fICMD\fR " This option sets the terminal emulator command \fICMD\fR that is used to to run terminal applications in. \fICMD\fR needs to end with an execute option, such as xterm's -e option, which will run the command that is appended to \fICMD\fR. The default is "xterm -e". Debian specific: Per Debian policy, default changed to "x-terminal-emulator -e" .IP "\fB\-\-dynamic\fR " This option is to be used with creating dynamic menus using \fBDynamicPopUpAction\fR and \fBDynamicPopDownAction\fR. This adds a 'recreate' to the \fBDestroyMenu\fR command on the top level menu so those actions are not Destroyed when the menu is regenerated. .IP "\fB\-\-insert\-in\-menu\fR \fINAME\fR" Option to insert generated menu(s) \fBIN\fR a menu \fINAME\fR (its top title). This option makes it so the top level menu is not Destroyed and the items are added to the end. Note menus regenerated with this option will append the menu items at the end of the existing menu. Each time the menu is regenerated new menu items appear giving a growing menu of duplicate items. You have to regenerate the whole menu via a function or restart fvwm. See \fBEXAMPLES\fR below for some solutions. .IP "\fB\-\-set\-menus\fR \fImenu_paths\fR" Generates all menus listed in a space separated list of full menu paths. This option overrides any defaults and \fB\-\-desktop\fR|\fB\-\-menu\-type\fR settings. .IP "\fB\-\-menu-error\fR |\fB\-t\fR" If this option is present and python-xdg is not found, the script will print the error in the generated menu. Used in the default-config. .IP "\fB\-\-verbose\fR" Enables additional information printouts on STDERR. .IP "Icons Options" By default, fvwm-menu-desktop builds menus without mini\-icons. To enable mini\-icons use the following options. If ImageMagick is installed on the system, the script will resize and copy the icons to $FVWM_USERDIR/.icons. This can take awhile. You should be prepared to wait the first time you generate the icons. Once the icons have been generated the script should run faster. If it is still to slow using icons, see \fBEXAMPLES\fR for ways to limit how often the menu is generated to speed things up. .IP "\fB\-\-enable\-mini\-icons\fR" This option enables mini\-icons in the menus. If set, 24x24 mini-icons are used. If the specified icon isn't that size it will be converted if \fBImageMagick\fR is installed and saved in $HOME/.fvwm/icons or to the directory specified with \-\-mini\-icon\-dir option. Otherwise no icon appears in the menu for that entry. With most distributions, all the menu entries will have mini-icons appropriate to the application. .IP "\fB\-\-theme\fR \fINAME\fR" Defines the used icon theme. Default is \fIgnome\fR but all others found in /usr/share/icons could be used except the \fIhicolor\fR theme because it's the default fallback theme if no icon is found. .IP "\fB\-\-size\fR|\fB\-s\fR \fINUM\fR" If \-\-enable\-mini\-icons is used the \fIsize\fR of the icons can changed with this parameter. Default is 24. .IP "\fB\-\-mini\-icon\-dir\fR \fIDIR\fR" When the right size mini-icon isn't available, fvwm-menu-desktop creates icons with the right size in $HOME/.fvwm/icons. If you don't want to use the default directory, $HOME/.fvwm/icons, use this option to specify a different folder. .IP "\fB\-\-app\-icon\fR \fINAME\fR" Sets the default application icon if no others are found. Default is \'gnome-applications'. .IP "\fB\-\-dir\-icon\fR \fINAME\fR" Sets the default directory icon if no others are found. Default is \'gnome-fs-directory'. .SH USAGE \fBfvwm-menu-desktop\fR outputs XDG .menu files in the syntax of fvwm menus. When \fBfvwm-menu-desktop\fR is run with no options, it will load defaults from the \fBFvwmForm-XDGMenu-Config\fR file (see below) then search your system for suitable menu file(s). To see which menus are available on your system run: .RS .EX fvwm-menu-desktop --get-menus all .EE .RE If no menus are found you may not have any installed on your system. By default menus are stored as *.menu files in /etc/xdg/menus, $HOME/.config/menus or the location set in $XDG_MENU_PREFIX. You can use \fB\-\-install\-prefix\fR to specify another location search for menus. Though a combination of command line options and the \fBFvwmForm-XDGMenu-Config\fR settings, \fBfvwm-menu-desktop\fR can generate any combination of the menus found. To get a list of what menu(s) would be generated use the \fB--get-menus\fR \fIdesktop\fR option. The following will list all menus generated if \fBfvwm-menu-desktop\fR was run with no options. .RS .EX fvwm-menu-desktop --get-menus desktop .EE .RE \fBfvwm-menu-desktop\fR determines which menu(s) to generate as follows .RS If no config file is found, all menus will be weighted and the script will generate the best (highest weight) menu found. If a config file is found (and override options are not used) the script will generate all menus selected in \fBFvwmForm-XDGMenu-Config\fR. \fB--desktop\fR, \fB--menu-type\fR, \fB--set-menus\fR and \fB--all-menus\fR will override any menus selected in \fBFvwmForm-XDGMenu-Config\fR. \fB--desktop\fR and \fB--menu-type\fR will only include menus whose name matches '*desktop*menutype*'. If used with \fB--all-menus\fR, all matching menus are generated. If used without \fB--all-menus\fR, only the highest weighted menu is generated. \fB--set-menus\fR generates menus from the list of full path menu file names. \fB--all-menus\fR by itself will generate all menus found. .RE By default \fBfvwm-menu-desktop\fR will generate a menu whose top level name is "XDGMenu". To tell fvwm to read the output of \fBfvwm-menu-desktop\fR to create the menu XDGMenu add the following to your fvwm config file: .RS .EX PipeRead 'fvwm-menu-desktop' .EE .RE \fBWarning:\fR Depending on the options used this command may be slow and fvwm will pause until this command is complete. See \fBEXAMPLES\fR below for more details and possible workarounds. Once the menu is generated you can open the menu by using the command "Menu XDGMenu". You can also include this in the MenuFvwmRoot menu by: .RS .EX AddToMenu MenuFvwmRoot "XDG Menu" Popup XDGMenu .EE .RE \fBfvwm-menu-desktop\fR can be configured though both command line options and a \fBFvwmForm\fR GUI to customize the menu(s) that get generated. .SH GUI \fBFvwmForm-XDGMenu-Config\fR is a \fBFvwmForm\fR interface that can be used to configure the defaults for \fBfvwm-menu-desktop\fR. You can access this from the "Configure" item in the top level menu that is generated or run the following from within \fBFvwmConsole\fR .RS .EX Module FvwmPerl -l fvwm-menu-desktop-config.fpl .EE .RE This form can be used to select which menu(s) get generated by default along with setting many (but not all) of the available options. When you click "Save Settings" the form will write a config file located at $FVWM_USERDIR/.FvwmForm-XDGMenu-Config that \fBfvwm-menu-desktop\fR will parse for defaults when run. See the help inside of \fBFvwmForm-XDGMenu-Config\fR for more information. .SH EXAMPLES There are many ways to setup when fvwm runs \fBfvwm-menu-desktop\fR to generate the menu. One method is to just generate the menu when fvwm loads and then use the GUI config tool to change any options. To do this you only need to add the following to the fvwm config file: .RS .EX AddToMenu MenuFvwmRoot "XDG Menu" Popup XDGMenu PipeRead 'fvwm-menu-desktop' .EE .RE The menu is created once when fvwm loads. Since menu creation can sometimes be slow, this could cause fvwm to take longer to load than one wants. The menu is only generated when fvwm starts. If software is installed or removed you will have to select the 'Regenerate' option to rebuild the menu. One way to speed things up is to save the menu in a file and only generate the menu when 'Regenerate' is selected. To do this use \fB--regen-cmd\fR to call a custom function and write the menu to a file using a command like .RS .EX fvwm-menu-desktop --regen-cmd XDGRegen > $FVWM_USERDIR/.XDGMenu .EE .RE Then add the following to the fvwm config file to define the function XDGRegen. The second to last line will generate the menu if the menu file doesn't exist when fvwm starts. .RS .EX DestroyFunc XDGRegen AddToFunc XDGRegen + I PipeRead 'fvwm-menu-desktop --regen-cmd XDGRegen > \\ $[FVWM_USERDIR]/.XDGMenu; echo "Nop"' + I Read $[FVWM_USERDIR]/.XDGMenu Test (!f $[FVWM_USERDIR]/.XDGMenu) XDGRegen Read $[FVWM_USERDIR]/.XDGMenu .EE .RE Besides creating a top level menu, \fBfvwm-menu-desktop\fR can insert the menu into an existing menu using the \fB--insert-in-menu\fR option. For example one could create the menu MenuFvwmRoot and include the XDG items at the end. .RS .EX DestroyMenu MenuFvwmRoot AddToMenu MenuFvwmRoot "Fvwm" Title + "Item1" Action1 ... + "ItemN" ActionN + "" Nop PipeRead 'fvwm-menu-desktop --insert-in-menu MenuFvwmRoot' .EE .RE In this case the menu items are inserted at the end of the MenuFvwmRoot menu. If no items are in the menu, this menu becomes MenuFvwmRoot. The problem here is, that you have to restart fvwm or rebuild the whole menu to Regenerate it because menu items cannot be removed. To do this you could use a function like .RS .EX DestroyFunc XDGRegen AddToFunc XDGRegen + I DestroyMenu MenuFvwmRoot + I AddToMenu MenuFvwmRoot "Fvwm" Title + I AddToMenu MenuFvwmRoot "Item1" Action1 ... + I AddToMenu MenuFvwmRoot "ItemN" ActionN + I AddToMenu MenuFvwmRoot "" Nop + I PipeRead 'fvwm-menu-desktop --insert-in-menu MenuFvwmRoot \\ --regen-cmd XDGRegen' .EE .RE Fvwm can also create menus dynamically by using \fBDynamicPopUpAction\fR and/or \fBDynamicPopDownAction\fR. These commands when used with a Menu will run a Function when the menu is opened. For example one could create the menu XDGMenu when it is opened using .RS .EX AddToMenu XDGMenu "XDGMenu" Title + DynamicPopUpAction PipeRead 'fvwm-menu-desktop' .EE .RE This will create the menu when it is opened. One issue here is it will only create the menu the first time it is opened, and you still have to Regenerate the menu to see any changes. To create the menu each time it is open used the \fB--dynamic\fR option .RS .EX AddToMenu XDGMenu "XDGMenu" Title + DynamicPopUpAction PipeRead 'fvwm-menu-desktop \\ --dynamic --include-items config' + DynamicPopDownAction DestroyMenu recreate XDGMenu .EE .RE This will now Destroy the menu when it closed so it can be rebuilt the next time it is opened. The recreate flag doesn't completely destroy the menu keeping the DynamicPopUpAction and DynamicPopDownAction actions. The \fB--dynamic\fR flag includes the recreate option in the generated menus. To insert a menu into MenuFvwmRoot and still be dynamic you need to use a function that generates the whole menu. For example .RS .EX DestroyFunc GenRootMenu AddToFunc GenRootMenu + I DestroyMenu recreate MenuFvwmRoot + I AddToMenu MenuFvwmRoot "Fvwm" Title + I AddToMenu MenuFvwmRoot "Item1" Action1 ... + I AddToMenu MenuFvwmRoot "ItemN" ActionN + I AddToMenu MenuFvwmRoot "" Nop + PipeRead `fvwm-menu-desktop --insert-in-menu MenuFvwmRoot \\ --include-items config` AddToMenu MenuFvwmRoot "Fvwm" Title + DynamicPopUpAction GenRootMenu + DynamicPopDownAction DestroyMenu recreate MenuFvwmRoot .EE .RE .SH BUGS The whole process of creating menus from files is slow. Otherwise report bugs to the fvwm-workers mailing list . .SH AUTHORS This script is based on fvwm-xdg-menu.py written by Piotr Zielinski (http://www.cl.cam.ac.uk/~pz215/) who assigned Licence: GPL 2 Date: 03.12.2005. The script was reworked to replace the existing fvwm-menu-desktop perl script by the fvwm-workers. .SH COPYING The script is distributed by the same terms as fvwm itself. See GNU General Public License for details.