! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Whisker: .desktop files exec entry contains escaped spaces -> doesn't work
Status:
RESOLVED: INVALID
Product:
Xfce4-whiskermenu-plugin
Component:
General

Comments

Description felix.bau 2015-05-12 15:42:06 CEST
Created attachment 6244 
example .desktop file

This is a whisker bug:
Whisker doesn't handle escaped spaces in exec file_paths correctly.
I attached a desktop file that I placed in /usr/share/applications/
Whisker complains that it cannot execute /opt/Sublime rather than /opt/Sublime Text 3/sublime_text as it should, even though the spaces in the directory name are escaped.

If I execute the file through thunar, then it works just fine

If I put quotes (" ") around the exec line then the whisker entry works just fine, but thunar and my desktop show an error that it cannot find the file.

example file is attached
the exed line:
Exec=/opt/Sublime\ Text\ 3/sublime_text


I hope you can fix it ;)

Regards,
Felix

PS: it would be nice if you could add a way to add existing .desktop files to the menu through whisker itself so that I don't need to move it manually to /usr/share/applications/ with the terminal
Comment 1 Graeme Gott editbugs 2015-09-21 23:27:29 CEST
Technically, the .desktop file you are using is invalid. Also, Whisker Menu doesn't parse the .desktop files. That is done by garcon, which is where this bug should have been reported.

According to the desktop entry spec [1][2], you are supposed to double escape space characters in the Exec key because it is of the type "string", which requires backslashes before spaces, and then you must escape backslashes in the Exec key. It is confusing, but you are supposed to use *two* backslashes instead of one:

Exec=/opt/Sublime\\ Text\\ 3/sublime_text
Exec=/opt/Sublime\\ Text\\ 3/sublime_text -n
Exec=/opt/Sublime\\ Text\\ 3/sublime_text --command new_file

If you prefer double quoting, do not quote the whole Exec line. Just quote the executable and path. Again, blame the desktop specification. Each argument can be double quoted and then separated by spaces:

Exec="/opt/Sublime Text 3/sublime_text"
Exec="/opt/Sublime Text 3/sublime_text" -n
Exec="/opt/Sublime Text 3/sublime_text" --command new_file

[1] http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#value-types
[2] http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables

Bug #11902

Reported by:
felix.bau
Reported on: 2015-05-12
Last modified on: 2015-09-21

People

Assignee:
Nick Schermer
CC List:
2 users

Version

Attachments

example .desktop file (541 bytes, application/x-desktop)
2015-05-12 15:42 CEST , felix.bau
no flags

Additional information