[Pkg-sugar-devel] Extra spaces in a .desktop file

James Cameron quozl at laptop.org
Mon Jul 22 22:00:05 BST 2019


On Thu, Jul 18, 2019 at 08:20:43PM +0000, Eyal Rozenberg wrote:
> The sugar-browse-activity package has a file named:
> 
> /usr/share/applications/org.laptop.WebActivity.activity.desktop
> 
> the key-value pairs in that files are separated by " = " instead of
> just "=", which apparently is erroneous, or at least - noticed and
> complained about by some other KDE apps. Please consider dropping
> those spaces.

Thanks for the report.  You're right about the whitespace.

Specification allows whitespace either side of '=';

https://specifications.freedesktop.org/desktop-entry-spec/latest/
https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s03.html

"Space before and after the equals sign should be ignored; the = sign
is the actual delimiter."

Which KDE apps need changing to comply with this specification?

I've considered dropping the spaces.  The file is generated by
sugar-toolkit-gtk3:src/sugar3/activity/bundlebuilder.py using Python's
ConfigParser module.  Here's a reproducer;

#!/usr/bin/python
import ConfigParser

cp = ConfigParser.ConfigParser()
cp.add_section('Desktop Entry')
cp.set('Desktop Entry', 'Exec', '/usr/bin/true')
cp.write(file('/tmp/true.desktop', 'w'))

This does generate a file with spaces.  There's no option in
ConfigParser to remove them.  Python ships with ConfigParser
containing a write method with format string of "%s = %s\n".

We could subclass ConfigParser in the hope it will never change, or
write to a buffer instead of a file and do a global replace of ' = '
with '='.

But first, let's ask the KDE app authors if they'll follow the
specification?

-- 
James Cameron
http://quozl.netrek.org/



More information about the pkg-sugar-devel mailing list