phillbush / xmenu

a x11 menu utility
Other
296 stars 26 forks source link

Coop with xdg-xmenu script #12

Closed raven2cz closed 4 years ago

raven2cz commented 4 years ago

Hello, I tried create menu config file with xdg-menu script. The menu definition file is created correctly. But there are several apps which have no icons. In these cases the script generate lines without image icons, like this:

IMG: Science IMG:/home/box/.cache/xdg-xmenu/icons/cantor.png Cantor (Frontend to Mathematical Software) cantor -qwindowicon cantor -qwindowtitle R (environment for statistical computing) xterm -e R IMG:/home/box/.cache/xdg-xmenu/icons/octave.png GNU Octave /usr/bin/octave --gui IMG:/home/box/.cache/xdg-xmenu/icons/kalgebra.png KAlgebra (Graph Calculator) kalgebra IMG:/home/box/.cache/xdg-xmenu/icons/kalgebra.png KAlgebra Mobile (Pocket Graph Calculator) kalgebramobile IMG:/home/box/.cache/xdg-xmenu/icons/kalzium.png Kalzium (Periodic Table of Elements) kalzium -qwindowtitle IMG:/home/box/.cache/xdg-xmenu/icons/marble.png KDE Marble (Virtual Globe) marble IMG:/home/box/.cache/xdg-xmenu/icons/libreoffice-math.png LibreOffice Math (Formula Editor) libreoffice --math IMG:/home/box/.cache/xdg-xmenu/icons/rocs.png Rocs (Rocs Graph Theory) rocs -qwindowtitle Julia xterm -e julia Singular xterm -e Singular

In the submenu names, there can be icons too. But if the image missing, the IMG: prefix with empty icon is present. I think that this cause this type of error after running:

❯ xmenu < menu xmenu: cannot load icon

there is problem that this error message doesn't show which line or better description which line is wrong. It seems that the image missing, but it is not trivial to find which line is wrong.

phillbush commented 4 years ago

xmenu doesn't keep track of line numbers, so it cannot tell the line number where the error occurred.
But I think I can print the line where the error occurred or print the wrong filename or whether the filename is blank.

I will also provide a better error string like "file not found", "file not supported", etc.

phillbush commented 4 years ago

Fixed with the last commit.
Now xmenu does not exits on error when a image cannot be loaded: just a warning is output to stderr.
And error messages have been improved.