guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add helper for .desktop file creation?


From: Nicolas Goaziou
Subject: Re: Add helper for .desktop file creation?
Date: Sat, 25 May 2019 15:33:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Pierre Neidhardt <address@hidden> writes:

> You are absolutely right, my initial implementation is not ready for
> merge, but it's already useful as a proof of concept.

Certainly. Also, it is a step in the right direction.

> Would you happen to know where this is implemented in Nix?

<https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/make-desktopitem/default.nix>

It is very straightforward, actually. There is not much to borrow.

> Or... I'm thinking we could do even better: use #:allow-other-keys then
> generate the entry from the key symbol (e.g. #:categories would generate
> "Categories").  This way the function would not have to hard-code the
> keys.

Making typos would be easier, then. I'd rather have a more limited, yet
more robust, function. I.e., I think it is better to stick to standard
keys. Otherwise, it adds little over current solution.

> Regarding your point on the string vs. list values, I suggest we accept
> both for all arguments and we string-join the lists.

If we go the "limited" route, we should also pay attention to expected
value types, i.e., only accept list of strings for entries with
"string(s)" values. Semicolons would need to be escaped when a list of
strings is allowed, too. 

In a nutshell, my suggestion would be:

- string, boolean, numeric : string, possibly with a check for boolean
  (throw an error if not "true" or "false"),

- string(s) : string, or list of strings, semicolons are escaped
  automatically,

- localestring : alist with "lang" as keys and strings as values, with
  a default key (possibly #f), or a plain string if there is only the
  default key.

This is more work than on the #:allow-other-keys options, but I think it
would make for a better tool.

WDYT?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]