all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Add helper for .desktop file creation?
@ 2019-05-24  7:53 Pierre Neidhardt
  2019-05-25 12:06 ` Nicolas Goaziou
  0 siblings, 1 reply; 19+ messages in thread
From: Pierre Neidhardt @ 2019-05-24  7:53 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 1748 bytes --]

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/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-05-30  8:24 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-24  7:53 Add helper for .desktop file creation? Pierre Neidhardt
2019-05-25 12:06 ` Nicolas Goaziou
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

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.