fvwm-menu-desktop(1)

πŸ“¦
version 2.7.0 Β· 6 versions
, in alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸŽ€ fvwm-menu-desktop(1) πŸŽ€

hiii bestie 🫢 welcome to the manual page for fvwm-menu-desktop, a proud member of the Fvwm Modules family. this is part 1 of 2, so don't go anywhere, there's more coming ✨


πŸ’– NAME πŸ’–

fvwm-menu-desktop β€” reads XDG menu files and creates Fvwm menus. that's the whole job description and she does it flawlessly πŸ’…


🌈 SYNOPSIS 🌈

fvwm-menu-desktop [ --help|-h ] [ --version ] [ --install-prefix DIR ] [
--desktop NAME ] [ --menu-type NAME ] [ --theme NAME ] [
--with-titles|-w ] [ --without-titles ] [ --enable-mini-icons ] [
--size|-s NUM ] [ --mini-icon-dir DIR ] [ --app-icon NAME ] [ --dir-icon
NAME ] [ --title|-t NAME ] [ --insert-in-menu NAME ] [ --get-menus
all|desktop ] [ --set-menus menu_paths ] [ --all-menus ] [
--include-items NAME ] [ --regen-cmd CMD ] [ --term-cmd CMD ] [
--dynamic ] [ --menu-error|-e ] [ --verbose|-v ]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. this is a python script πŸ’… that parses your XDG menu definitions and builds the matching fvwm menus out of them. and listen β€” she depends on python-xdg to run, so if that isn't on your system she literally cannot function, no cap 😭


✨ OPTIONS ✨

πŸ’– Main Options πŸ’–

  • --help β€” shows the help and then exits. she's done, she's leaving, bye πŸ‘‹
  • --version β€” shows the version and exits. quick little flex ✨
  • --get-menus all|desktop β€” prints a space separated list of the full menu paths she found on your system. all = every menu found on the system except the empty ones. desktop = the menu(s) that would be generated by the script. and bestie, no menu generation is done here at all, she's just showing you the receipts πŸ”₯
  • --desktop NAME β€” optional, sets the NAME of the desktop XDG .menu file(s) to use. this one overrides any default menus you set through FvwmForm-XDGMenu-Config, and makes the script hunt for menus where NAME is part of the file name. possible names: gnome, kde, xfce, lxde, debian, etc. you can run this together with --menu-type to control which .menu file(s) get used. it's a duo, not a solo 🫢
  • --menu-type NAME β€” optional, sets the NAME of the XDG menu type to use. this overrides any default menus set via FvwmForm-XDGMenu-Config and makes the script look for menus where NAME is part of the file name. possible NAME types could be: applications, settings, preferences, etc. when you pair it with --desktop, only menus whose file name matches '*destkop*menutype*' are found. and if no menus are found, the script exits with an error. not a vibe but okay πŸ’€
  • --all-menus β€” builds all the menus found on the system. pair it with --desktop or --menu-type and she'll build every menu matching those settings. she's doing the MOST πŸ‘‘
  • --install-prefix DIR β€” optional, overrides the standard locations for XDG menu definitions. tells fvwm-menu-desktop to look in DIR for .menu files instead of the usual spots, /etc/xdg/menus (and $HOME/.config/menus if it exists).
  • --with-titles|-w β€” if this is set, menus get generated with titles. this is the default. use it to override the FvwmForm-XDGMenu-Config default setting.
  • --without-titles β€” if this is set, menus get generated without titles. the default is to generate with titles. so this is the "actually, no" button.
  • --title|-t NAME β€” defines the menu title NAME of the top menu, the one used by Fvwm's Menu or Popup commands. default is "XDGMenu".
  • --include-items NAME β€” controls whether the extra menu items 'Regenerate' and 'Configure' get included in the top level menu. NAME can be one of regenerate, config, both, or none. default is both.
  • --regen-cmd CMD β€” sets the fvwm command CMD that runs when the menu item 'Regenerate' is selected. default is PipeRead `fvwm-menu-desktop`.
  • --term-cmd CMD β€” sets the terminal emulator command CMD used to run terminal applications in. CMD needs to end with an execute option, such as xterm's -e option, which will run the command that gets appended to CMD. default is "xterm -e".
  • --dynamic β€” for creating dynamic menus with DynamicPopUpAction and DynamicPopDownAction. this adds a 'recreate' to the DestroyMenu command on the top level menu, so those actions don't get Destroyed when the menu is regenerated. protective queen πŸ‘‘
  • --insert-in-menu NAME β€” inserts the generated menu(s) in a menu NAME (its top title). this makes it so the top level menu isn't Destroyed and the items get added to the end.
⚠️ heads up bestie: menus regenerated with this option will append the menu items at the end of the existing menu. every single time the menu is regenerated, new menu items show up, giving you a growing menu of duplicate items 😭 you have to regenerate the whole menu via a function or restart fvwm. see EXAMPLES below for some solutions.
  • --set-menus menu_paths β€” generates all the menus listed in a space separated list of full menu paths. this option overrides any defaults and any --desktop|--menu-type settings.
  • --menu-error |-t β€” if this option is present and python-xdg is not found, the script prints the error in the generated menu. used in the default-config.
  • --verbose β€” enables additional information printouts on STDERR. she's telling you everything, oversharing era πŸ’€

πŸ¦‹ Icons Options πŸ¦‹

by default, fvwm-menu-desktop builds menus without mini-icons. to turn mini-icons on, use the following options πŸ‘‡

if ImageMagick is installed on the system, the script will resize and copy the icons to $FVWM_USERDIR/.icons. and bestie, 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's still too slow using icons, check EXAMPLES for ways to limit how often the menu is generated to speed things up.

  • --enable-mini-icons β€” enables mini-icons in the menus. if set, 24x24 mini-icons are used. if the specified icon isn't that size it'll be converted (if ImageMagick is installed) and saved in $HOME/.fvwm/icons or to the directory specified with the --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 ✨
  • --theme NAME β€” defines the used icon theme. default is gnome, but all the others found in /usr/share/icons could be used β€” except the hicolor theme, because it's the default fallback theme if no icon is found. don't fight her on this one πŸ’…
  • --size|-s NUM β€” if --enable-mini-icons is used, the size of the icons can be changed with this parameter. default is 24.
  • --mini-icon-dir DIR β€” 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.
  • --app-icon NAME β€” sets the default application icon if no others are found. default is 'gnome-applications'.
  • --dir-icon NAME β€” sets the default directory icon if no others are found. default is 'gnome-fs-directory'.

πŸŽ€ USAGE πŸŽ€

fvwm-menu-desktop outputs XDG .menu files in the syntax of fvwm menus. when you run it with no options, it loads the defaults from the FvwmForm-XDGMenu-Config file (see below), then searches your system for suitable menu file(s). to see which menus are available on your system, run:

fvwm-menu-desktop --get-menus all

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 --install-prefix to specify another location to search for menus.

through a combination of command line options and the FvwmForm-XDGMenu-Config settings, fvwm-menu-desktop can generate any combination of the menus found. to get a list of what menu(s) would be generated, use the --get-menus desktop option. the following will list all menus generated if fvwm-menu-desktop was run with no options:

fvwm-menu-desktop --get-menus desktop

fvwm-menu-desktop determines which menu(s) to generate like this:

  • if no config file is found, all menus will be weighted and the script will generate the best (highest weight) menu found. main character selection process ✨
  • if a config file is found (and override options are not used), the script will generate all menus selected in FvwmForm-XDGMenu-Config.
  • --desktop, --menu-type, --set-menus and --all-menus will override any menus selected in FvwmForm-XDGMenu-Config.
  • --desktop and --menu-type will only include menus whose name matches '*desktop*menutype*'. if used with --all-menus, all matching menus are generated. if used without --all-menus, only the highest weighted menu is generated.
  • --set-menus generates menus from the list of full path menu file names.
  • --all-menus by itself will generate all menus found.

by default fvwm-menu-desktop will generate a menu whose top level name is "XDGMenu". to tell fvwm to read the output of fvwm-menu-desktop to create the menu XDGMenu, add the following to your fvwm config file:

PipeRead 'fvwm-menu-desktop'
⚠️ Warning: depending on the options used, this command may be slow and fvwm will pause until this command is complete. see EXAMPLES 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:

AddToMenu MenuFvwmRoot "XDG Menu" Popup XDGMenu

fvwm-menu-desktop can be configured through both command line options and a FvwmForm GUI to customize the menu(s) that get generated. πŸ’…


🌸 GUI 🌸

FvwmForm-XDGMenu-Config is a FvwmForm interface that can be used to configure the defaults for fvwm-menu-desktop. you can access this from the "Configure" item in the top level menu that is generated, or run the following from within FvwmConsole:

Module FvwmPerl -l fvwm-menu-desktop-config.fpl

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 fvwm-menu-desktop will parse for defaults when it runs.

see the help inside of FvwmForm-XDGMenu-Config for more information 🫢

✨ EXAMPLES ✨

Okay bestie, this is the part where it all comes together πŸ’– There are so many ways to set things up when fvwm runs fvwm-menu-desktop to generate the menu. Let's go through them, no cap.

One method is just to generate the menu when fvwm loads, and then use the GUI config tool to change any options you want. To do that, all you need is to add the following to the fvwm config file:

AddToMenu MenuFvwmRoot "XDG Menu" Popup XDGMenu
PipeRead 'fvwm-menu-desktop'

The menu is created once when fvwm loads. And since menu creation can sometimes be slow, ngl this could cause fvwm to take longer to load than one wants 😭

Also the menu is only generated when fvwm starts. So if software is installed or removed, you will have to select the Regenerate option to rebuild the menu. Periodt.


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 that, use --regen-cmd to call a custom function and write the menu to a file using a command like

fvwm-menu-desktop --regen-cmd XDGRegen > $FVWM_USERDIR/.XDGMenu

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.

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

Besides creating a top level menu, fvwm-menu-desktop can insert the menu into an existing menu using the --insert-in-menu option 🫢 For example, one could create the menu MenuFvwmRoot and include the XDG items at the end.

DestroyMenu MenuFvwmRoot
AddToMenu MenuFvwmRoot "Fvwm" Title
+ "Item1" Action1
  ...
+ "ItemN" ActionN
+ "" Nop
PipeRead 'fvwm-menu-desktop --insert-in-menu MenuFvwmRoot'

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 that you could use a function like

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'

Fvwm can also create menus dynamically by using DynamicPopUpAction and/or DynamicPopDownAction. 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

AddToMenu XDGMenu "XDGMenu" Title
+ DynamicPopUpAction PipeRead 'fvwm-menu-desktop'

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, use the --dynamic option:

AddToMenu XDGMenu "XDGMenu" Title
+ DynamicPopUpAction PipeRead 'fvwm-menu-desktop \
                     --dynamic --include-items config'
+ DynamicPopDownAction DestroyMenu recreate XDGMenu

This will now Destroy the menu when it's closed, so it can be rebuilt the next time it is opened. The recreate flag doesn't completely destroy the menu β€” it keeps the DynamicPopUpAction and DynamicPopDownAction actions πŸ’… The --dynamic 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

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

πŸ’€ BUGS πŸ’€

The whole process of creating menus from files is slow. Not me stating the obvious but it fr is 😭

Otherwise, report bugs to the fvwm-workers mailing list <fvwm-workers@fvwm.org>.


πŸ‘‘ 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. Iconic behaviour tbh πŸŽ€


πŸ“œ COPYING πŸ“œ

The script is distributed by the same terms as fvwm itself. See GNU General Public License for details.


And that's the whole page, bestie! 🌈 This little masterpiece comes to you from the 3rd Berkeley Distribution, dated 19 October 2022 (2.7.0), and yes it's the fvwm-menu-desktop(1) man page πŸ¦‹ Go forth and build the cutest XDG menu ever, you absolute main character πŸ’–βœ¨