Xdgmenu disappeared

I use fvwm over Linux Mint Mate 20. XDGMenu is generated by mate menu:
PipeRead “fvwm-menu-desktop --desktop mate -e --enable-mini-icons --mini-icon-dir $[FVWM_USERDIR]/icons/mini-icons --theme mate --size 16”
It worked well. Yesterday I installed programm under wine and XDG menu disappered. In file .xsession-errors :
Traceback (most recent call last):
File “/usr/bin/fvwm-menu-desktop”, line 821, in main()
File “/usr/bin/fvwm-menu-desktop”, line 388, in main
parsemenus(menulist, desktop)
File “/usr/bin/fvwm-menu-desktop”, line 677, in parsemenus
parsemenu(xdg.Menu.parse(menu), name, title)
File “/usr/lib/python3/dist-packages/xdg/Menu.py”, line 1137, in parse
return XMLMenuBuilder(debug).parse(filename)
File “/usr/lib/python3/dist-packages/xdg/Menu.py”, line 646, in parse
File “/usr/lib/python3/dist-packages/xdg/Menu.py”, line 992, in post_parse
File “/usr/lib/python3/dist-packages/xdg/Menu.py”, line 992, in post_parse
File “/usr/lib/python3/dist-packages/xdg/Menu.py”, line 1006, in post_parse
elif menuentry.Type == MenuEntry.TYPE_SYSTEM:
AttributeError: ‘MenuEntry’ object has no attribute ‘Type’
Error in sys.excepthook:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/apport_python_hook.py”, line 153, in apport_excepthook
with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: ‘/var/crash/_usr_bin_fvwm-menu-desktop.1000.crash’

What happened and how to fix problem? I changed for lxde menu. It works, but menu is doubled. Everything appeared twice.


First, programs using wine create .desktop files and put them in ~/.local/share/applications/, so you might be able to look in there and move/remove the faulty .desktop file(s) it created which are causing fvwm-menu-desktop to fail. As for the error you are getting from python, the error that sticks out is AttributeError: ‘MenuEntry’ object has no attribute ‘Type’, which says to me the .desktop file this app created is missing a required attribute for the mate .menu.

Now as to why this causes the whole script to crash is a bug/issue with the python-xdg library. All fvwm-menu-desktop does is make use of that python library to generate the menu, and all our script does is parse the output, transform it into fvwm menu syntax and possibly create icons from it. So errors with creating the menu from python-xdg is an upstream issue. If you want to follow through on this, maybe report this bug upstream to python-xdg authors, and I would suggest something along the line they catch this error and just ignore the menu entry vs cause the script to error out.

As for your issue with lxde menu creating double entries, this was another bug in python-xdg that got reported in Debian, and eventually fixed. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=949738, so maybe you have an older version of python-xdg or the fix still has some issues. You might be able to find some relevant info in that bug report.

Thank you for your reply. All files .desktop have already been in that directory. Both problems were solved by installing the last version 0.27-2 of python3-xdg. As you noted it was a bug that was solved in the last version of python-xdg.
In my file .xsession-errors I found more errors the origin of which I do not understand. Maybe you know what is the problem? Many time appears the following information

convert-im6.q16: unable to open image .png/.pngh.pngo.pngm.pnge.png/.pngn.pnga.pngi.pngl.png/.png..pngf.pngv.pngw.pngm.png/.pngi.pngc.pngo.pngn.pngs.png/.pngm.pngi.pngn.pngi.png-.pngi.pngc.pngo.pngn.pngs.png/.png1.png6.pngx.png1.png6.png-.pngM.pngi.pngc.pngr.pngo.pngs.pngo.pngf.pngt.png .pngE.pngx.pngc.pnge.pngl.png .png2.png0.png0.png7.png': There is no such file or directory @ error/blob.c/OpenBlob/2874. convert-im6.q16: WriteBlob Failed .png/.pngh.pngo.pngm.pnge.png/.pngn.pnga.pngi.pngl.png/.png…pngf.pngv.pngw.pngm.png/.pngi.pngc.pngo.pngn.pngs.png/.pngm.pngi.pngn.pngi.png-.pngi.pngc.pngo.pngn.pngs.png/.png1.png6.pngx.png1.png6.png-.pngM.pngi.pngc.pngr.pngo.pngs.pngo.pngf.pngt.png .pngE.pngx.pngc.pnge.pngl.png .png2.png0.png0.png7.png’ @ error/png.c/MagickPNGErrorHandler/1641.

I have no clue what could be producing that. Do you know what script is trying to run convert (this is used by fvwm-menu-desktop and sometimes custom functions to convert images to use as icons)? But whatever script is trying to run that command is creating some crazy path which then ends up trying to open a file that doesn’t exist. First you need to track down which script/function is actually trying to run convert with this crazy path, then you might be able to debug it.

You can run fvwm-menu-desktop or other scripts from a terminal, and see if you get any of these errors, this can help isolate what could be causing it. For instance run the command in your PipeRead statement from a terminal: fvwm-menu-desktop --desktop mate -e --enable-mini-icons --mini-icon-dir $[FVWM_USERDIR]/icons/mini-icons --theme mate --size 16. You should see it output fvwm menu syntax, but if you see this error popup, you might be able to identify which menu item (thus .desktop) file is causing the script to have issues (or maybe the .desktop file itself has issues).

Thank you very much. I found the origins of these errors. It was connected with icons of msoffice which I installed by using PlayOnLinux. The files of icons had no extension png. I added by hand the extension and errors have disappeared. Now I have a single error “sh: 1: Syntax error: Missing ‘))’” I think it is connected with sh files which I use. Another question maybe you know a solution. The key --desktop mate include all menu with name mate. I do not need mate-screensavers.menu. How do I exclude this menu but save all others?

I don’t really know the best way to exclude items from the menus. In general we make use of desktop menus as fvwm doesn’t want to write its own .menu file. You could make a copy of the mate .menu file and edit it to your liking, then use that .menu file instead of the default one that comes with mate. This is the only way I know how to change the contents, but I don’t know enough to know anymore details than it is possible to write your own custom .menu file to use if the desktop ones don’t suit your needs. I have always used the lxde menu because I found it had the least extra stuff.

There is an option –menu-type to include a single part of mate menus. If I use –desktop mate --menu-type applications then only mate-applications.menu will be included. But this option can include the only menu. It does not work for a list of menus.

I found a simple solution. I made copies of mate-applications.menu and mate-settings.menu to my-applications and my-settings and in config write –desktop my. And that’s all.