From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Pierre Neidhardt <mail@ambrevar.xyz>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Add helper for .desktop file creation?
Date: Sat, 25 May 2019 14:06:20 +0200 [thread overview]
Message-ID: <87d0k67n7n.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <878suwz3tg.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Fri, 24 May 2019 09:53:15 +0200")
Hello,
Pierre Neidhardt <mail@ambrevar.xyz> writes:
> Quite a bunch of packages need to provide their own .desktop since
> upstream does not provide them. It's very evident in games.scm in
> particular.
Interestingly, I had the same itch recently.
> It seems to be a good opportunity to factor this out. What about the
> following?
>
> --8<---------------cut here---------------start------------->8---
> (define* (make-desktop-file destination #:key
> (encoding "UTF-8")
> name
> (generic-name name)
> comment
> exec
> icon
> (startup-notify "true")
> (terminal "false")
> (type "Application")
> (categories "Application"))
> "Create a desktop file at DESTINATION for executable EXEC with name NAME.
> Other arguments are optional."
> (let ((maybe-print (lambda (key value)
> (if value
> (string-append key "=" value "\n")
> ""))))
> (mkdir-p (dirname destination))
> (with-output-to-file destination
> (lambda _
> (display
> (string-append
> "[Desktop Entry]" "\n"
> "Encoding=" encoding "\n"
> "Name=" name "\n"
> "GenericName=" generic-name "\n"
> (maybe-print "Comment" comment)
> "Exec=" exec "\n"
> (maybe-print "Icon" icon)
> "StartupNotify=" startup-notify "\n"
> "Terminal=" terminal "\n"
> "Type=" type "\n"
> "Categories=" categories "\n"))))))
> --8<---------------cut here---------------end--------------->8---
It looks interesting. I have a couple of suggestions, if you don't mind:
- some items are missing, e.g., "Keywords".
As you may know, you can have a look at
<https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-
spec-latest.html> for a full list.
- some items you use a list of strings instead of a string (e.g.,
"Keywords", "Categories"),
- it would be nice to handle localized values for keys. For example
`drascula' package uses "Comment[fr]". It could possibly be
implemented with an alist as the value.
I know Nix provides such a function, but I haven't looked at its
implementation yet.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2019-05-25 12:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 7:53 Add helper for .desktop file creation? Pierre Neidhardt
2019-05-25 12:06 ` Nicolas Goaziou [this message]
2019-05-25 12:21 ` Nicolas Goaziou
2019-05-25 12:51 ` Pierre Neidhardt
2019-05-25 13:33 ` Nicolas Goaziou
2019-05-25 13:45 ` Nicolas Goaziou
2019-05-25 14:20 ` Pierre Neidhardt
2019-05-25 18:37 ` Pierre Neidhardt
2019-05-27 7:13 ` Pierre Neidhardt
2019-05-27 16:15 ` Nicolas Goaziou
2019-05-27 16:45 ` Pierre Neidhardt
2019-05-27 17:39 ` Nicolas Goaziou
2019-05-27 17:58 ` Pierre Neidhardt
2019-05-27 19:19 ` Nicolas Goaziou
2019-05-30 8:24 ` Pierre Neidhardt
2019-05-27 19:54 ` Marius Bakke
2019-05-27 21:02 ` Pierre Neidhardt
2019-05-25 13:38 ` Amin Bandali
2019-05-25 14:30 ` Danny Milosavljevic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d0k67n7n.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=guix-devel@gnu.org \
--cc=mail@ambrevar.xyz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.