[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Add helper for .desktop file creation?
From: |
Pierre Neidhardt |
Subject: |
Add helper for .desktop file creation? |
Date: |
Fri, 24 May 2019 09:53:15 +0200 |
Hi,
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.
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---
--
Pierre Neidhardt
https://ambrevar.xyz/
signature.asc
Description: PGP signature
- Add helper for .desktop file creation?,
Pierre Neidhardt <=
- Re: Add helper for .desktop file creation?, Nicolas Goaziou, 2019/05/25
- Re: Add helper for .desktop file creation?, Nicolas Goaziou, 2019/05/25
- Re: Add helper for .desktop file creation?, Pierre Neidhardt, 2019/05/25
- Re: Add helper for .desktop file creation?, Amin Bandali, 2019/05/25
- Re: Add helper for .desktop file creation?, Nicolas Goaziou, 2019/05/25
- Re: Add helper for .desktop file creation?, Nicolas Goaziou, 2019/05/25
- Re: Add helper for .desktop file creation?, Pierre Neidhardt, 2019/05/25
- Re: Add helper for .desktop file creation?, Pierre Neidhardt, 2019/05/25
- Re: Add helper for .desktop file creation?, Pierre Neidhardt, 2019/05/27
- Re: Add helper for .desktop file creation?, Nicolas Goaziou, 2019/05/27