Steps to reproduce: 1. Create a .desktop file with a vendor prefix and a space in the name. e.g., "foo-bar baz.desktop". 2. Run: xdg-desktop-menu install --mode user "foo-bar baz.desktop" Expected result: The file is copied to "~/.local/share/applications/foo-bar baz.desktop". Actual result: xdg-desktop-menu: filename 'baz.desktop' does not have a proper vendor prefix A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated with a dash ("-"). An example filename is 'example-baz.desktop' Use --novendor to override or 'xdg-desktop-menu --manual' for additional info. This is because it thinks I am passing two separate filenames ("foo-bar" and "baz.desktop") even though I correctly used quotes on the command line. This is caused by line 998 of the script, which concatenates all arguments ending in .desktop onto $desktop_files, separating each argument with a space. After that point, it is impossible to tell which spaces separate arguments and which are part of the filename. (Note that if all of the space-separated parts of the filename contain a "-", you don't see the above error, it just fails silently because it can't find the files it is trying to copy.)
Fixing this could get a little ugly... in the meantime I would simply and strongly recommend avoiding the use of .desktop filenames with spaces (converting " " to "_" or something...)
This affects more than just installing `.desktop` files. It also affects uninstalling *any* .directory file, with spaces or not, if `XDG_CONFIG_HOME/menus/applications-merged` contains a `.menu` file with spaces. In this case, a simple `xdg-desktop-menu uninstall vendor-foo.directory vendor-bar.desktop` *freezes*. Notice there's no spaces in those names! This was reported in Ubuntu as https://bugs.launchpad.net/xdg-utils/+bug/1432932 , and it contains a working patch that does not seem ugly: it simply quotes the vars as they should be. "avoiding the use of .desktop filenames with spaces" is not always an option: wine creates such files, and they do so by design (its .menu files are named after their windows `.lnk` counterparts). So if a user has wine-installed games, no other software will be able to uninstall its own .directory files! Any chance this patch could be merged?
By the way, I can see one of such unquoted vars was already fixed in git repository in commit http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=c96d7b00aca3da1b608fde5827d7fea8785b3cd3 , which is great... thanks Rex Dieter! This commit fixes the particular case of wine .menu files, which do not contain the 'generated and managed' "tag". But for a more general solution, there is another occurrence of the same var unquoted a few lines below at http://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-desktop-menu.in#n306 and a few lines above at #288. Care to fix those too? Thanks!
Thanks for the pointer, http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=236c283ec94e097986015e6f84c189a8e09e4aed
*** Bug 69339 has been marked as a duplicate of this bug. ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.