* [bug#36000] [PATCH 1/4] guix: Add helper for generating desktop entry files.
@ 2019-05-30 7:11 Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 2/4] gnu: emacs-exwm: Use make-desktop-entry-file Pierre Neidhardt
[not found] ` <handler.36000.B.155920231822519.ack@debbugs.gnu.org>
0 siblings, 2 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2019-05-30 7:11 UTC (permalink / raw)
To: 36000
* guix/build/utils.scm (make-desktop-entry-file): New procedure.
---
guix/build/utils.scm | 99 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 5fe3286843..21bdc42719 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1100,6 +1100,105 @@ with definitions for VARS."
(chmod prog-tmp #o755)
(rename-file prog-tmp prog))))
+(define* (make-desktop-entry-file destination #:key
+ (type "Application") ; One of "Application", "Link" or "Directory".
+ (version "1.1")
+ name
+ (generic-name name)
+ (no-display #f)
+ comment
+ icon
+ (hidden #f)
+ only-show-in
+ not-show-in
+ (d-bus-activatable #f)
+ try-exec
+ exec
+ path
+ (terminal #f)
+ actions
+ mime-type
+ (categories "Application")
+ implements
+ keywords
+ (startup-notify #t)
+ startup-w-m-class
+ #:rest all-args)
+ "Create a desktop entry file at DESTINATION.
+You must specify NAME.
+
+Values can be booleans, numbers, strings or list of strings.
+
+Additionally, locales can be specified with an alist where the key is the
+locale. The #f key specifies the default. Example:
+
+ #:name '((#f \"I love Guix\") (\"fr\" \"J'aime Guix\"))
+
+produces
+
+ Name=I love Guix
+ Name[fr]=J'aime Guix
+
+For a complete description of the format, see the specifications at
+https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html."
+ (define (escape-semicolon s)
+ (string-join (string-split s #\;) "\\;"))
+ (define* (parse key value #:optional locale)
+ (set! value (match value
+ (#t "true")
+ (#f "false")
+ ((? number? n) n)
+ ((? string? s) (escape-semicolon s))
+ ((? list? value)
+ (catch 'wrong-type-arg
+ (lambda () (string-join (map escape-semicolon value) ";"))
+ (lambda args (error "List arguments can only contain strings: ~a" args))))
+ (_ (error "Value must be a boolean, number, string or list of strings"))))
+ (format #t "~a=~a~%"
+ (if locale
+ (format #f "~a[~a]" key locale)
+ key)
+ value))
+
+ (define key-error-message "This procedure only takes key arguments beside DESTINATION")
+
+ (unless name
+ (error "Missing NAME key argument"))
+ (unless (member #:type all-args)
+ (set! all-args (append (list #:type type) all-args)))
+ (mkdir-p (dirname destination))
+
+ (with-output-to-file destination
+ (lambda ()
+ (format #t "[Desktop Entry]~%")
+ (let loop ((args all-args))
+ (match args
+ (() #t)
+ ((_) (error key-error-message))
+ ((key value . ...)
+ (unless (keyword? key)
+ (error key-error-message))
+ (set! key
+ (string-join (map string-titlecase
+ (string-split (symbol->string
+ (keyword->symbol key))
+ #\-))
+ ""))
+ (match value
+ (((_ . _) . _)
+ (for-each (lambda (locale-subvalue)
+ (parse key
+ (if (and (list? (cdr locale-subvalue))
+ (= 1 (length (cdr locale-subvalue))))
+ ;; Support both proper and improper lists for convenience.
+ (cadr locale-subvalue)
+ (cdr locale-subvalue))
+ (car locale-subvalue)))
+ value))
+ (_
+ (parse key value)))
+ (loop (cddr args))))))))
+
\f
;;;
;;; Locales.
--
2.21.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#36000] [PATCH 2/4] gnu: emacs-exwm: Use make-desktop-entry-file.
2019-05-30 7:11 [bug#36000] [PATCH 1/4] guix: Add helper for generating desktop entry files Pierre Neidhardt
@ 2019-05-30 8:17 ` Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 3/4] gnu: tome4: " Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 4/4] gnu: drascula: " Pierre Neidhardt
[not found] ` <handler.36000.B.155920231822519.ack@debbugs.gnu.org>
1 sibling, 2 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2019-05-30 8:17 UTC (permalink / raw)
To: 36000
* gnu/packages/emacs-xyz.scm (emacs-exwm)[arguments]: Do it.
---
gnu/packages/emacs-xyz.scm | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 9199b45e40..fed92528c3 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -7498,15 +7498,12 @@ It should enable you to implement low-level X11 applications.")
;; Add a .desktop file to xsessions
(mkdir-p xsessions)
(mkdir-p bin)
- (with-output-to-file
- (string-append xsessions "/exwm.desktop")
- (lambda _
- (format #t "[Desktop Entry]~@
- Name=~a~@
- Comment=~a~@
- Exec=~a~@
- TryExec=~:*~a~@
- Type=Application~%" ,name ,synopsis exwm-executable)))
+ (make-desktop-entry-file
+ (string-append xsessions "/exwm.desktop")
+ #:name ,name
+ #:comment ,synopsis
+ #:exec exwm-executable
+ #:try-exec exwm-executable)
;; Add a shell wrapper to bin
(with-output-to-file exwm-executable
(lambda _
--
2.21.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#36000] [PATCH 3/4] gnu: tome4: Use make-desktop-entry-file.
2019-05-30 8:17 ` [bug#36000] [PATCH 2/4] gnu: emacs-exwm: Use make-desktop-entry-file Pierre Neidhardt
@ 2019-05-30 8:17 ` Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 4/4] gnu: drascula: " Pierre Neidhardt
1 sibling, 0 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2019-05-30 8:17 UTC (permalink / raw)
To: 36000
* gnu/packages/games.scm (tome4)[arguments]: Do it.
---
gnu/packages/games.scm | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 4fdc9b01e6..af875435d6 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -5035,19 +5035,13 @@ Crowther & Woods, its original authors, in 1995. It has been known as
(copy-recursively "game" (string-append data "/game"))
;; launcher
(mkdir-p applications)
- (with-output-to-file (string-append applications "/"
- ,name ".desktop")
- (lambda ()
- (display
- (string-append
- "[Desktop Entry]
-Name=ToME4
-Comment=" ,synopsis "\n"
-"Exec=" ,name "\n"
-"Icon=" icon "\n"
-"Terminal=false
-Type=Application
-Categories=Game;RolePlaying;\n")))))
+ (make-desktop-entry-file
+ (string-append applications "/" ,name ".desktop")
+ #:name "ToME4"
+ #:comment ,synopsis
+ #:exec ,name
+ #:icon icon
+ #:categories '("Game" "RolePlaying")))
#t)))))
(home-page "https://te4.org")
(description "Tales of Maj’Eyal (ToME) RPG, featuring tactical turn-based
--
2.21.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [bug#36000] [PATCH 4/4] gnu: drascula: Use make-desktop-entry-file.
2019-05-30 8:17 ` [bug#36000] [PATCH 2/4] gnu: emacs-exwm: Use make-desktop-entry-file Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 3/4] gnu: tome4: " Pierre Neidhardt
@ 2019-05-30 8:17 ` Pierre Neidhardt
1 sibling, 0 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2019-05-30 8:17 UTC (permalink / raw)
To: 36000
* gnu/packages/games.scm (drascula)[arguments]: Do it.
---
gnu/packages/games.scm | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index af875435d6..94a44f0fc1 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -7276,22 +7276,18 @@ on items and player adaptability for character progression.")
;; game, so we borrow SCUMMVM's.
(let ((apps (string-append out "/share/applications")))
(mkdir-p apps)
- (with-output-to-file (string-append apps "/drascula.desktop")
- (lambda _
- (format #t
- "[Desktop Entry]~@
- Name=Drascula: The Vampire Strikes Back~@
- GenericName=Drascula~@
- Exec=~a/bin/drascula~@
- Icon=~a/share/icons/hicolor/scalable/apps/scummvm.svg~@
- Categories=AdventureGame;Game;RolePlaying;~@
- Keywords=game;adventure;roleplaying;2D,fantasy;~@
- Comment=Classic 2D point and click adventure game~@
- Comment[de]=klassisches 2D-Abenteuerspiel in Zeigen-und-Klicken-Manier~@
- Comment[fr]=Jeux classique d'aventure pointer-et-cliquer en 2D~@
- Comment[it]=Gioco classico di avventura punta e clicca 2D~@
- Type=Application~%"
- out scummvm))))
+ (make-desktop-entry-file
+ (string-append apps "/drascula.desktop")
+ #:name "Drascula: The Vampire Strikes Back"
+ #:generic-name "Drascula"
+ #:exec (string-append out "/bin/drascula")
+ #:icon (string-append scummvm "/share/icons/hicolor/scalable/apps/scummvm.svg")
+ #:categories '("AdventureGame" "Game" "RolePlaying")
+ #:keywords '("game" "adventure" "roleplaying" "2D" "fantasy")
+ #:comment '((#f "Classic 2D point and click adventure game")
+ ("de" "Klassisches 2D-Abenteuerspiel in Zeigen-und-Klicken-Manier")
+ ("fr" "Jeu classique d'aventure pointer-et-cliquer en 2D")
+ ("it" "Gioco classico di avventura punta e clicca 2D"))))
#t))))
(native-inputs
`(("bash" ,bash)
--
2.21.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
[parent not found: <handler.36000.B.155920231822519.ack@debbugs.gnu.org>]
* [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.)
[not found] ` <handler.36000.B.155920231822519.ack@debbugs.gnu.org>
@ 2019-10-12 8:43 ` Pierre Neidhardt
2019-10-12 18:44 ` Efraim Flashner
0 siblings, 1 reply; 15+ messages in thread
From: Pierre Neidhardt @ 2019-10-12 8:43 UTC (permalink / raw)
To: 36000; +Cc: Ludovic Courtès, Marius Bakke
[-- Attachment #1: Type: text/plain, Size: 109 bytes --]
Can we merge this in core updates?
Any blocker?
Thanks!
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.)
2019-10-12 8:43 ` [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.) Pierre Neidhardt
@ 2019-10-12 18:44 ` Efraim Flashner
2019-10-12 19:05 ` Pierre Neidhardt
0 siblings, 1 reply; 15+ messages in thread
From: Efraim Flashner @ 2019-10-12 18:44 UTC (permalink / raw)
To: Pierre Neidhardt; +Cc: Marius Bakke, 36000, Ludovic Courtès
[-- Attachment #1: Type: text/plain, Size: 567 bytes --]
On Sat, Oct 12, 2019 at 10:43:56AM +0200, Pierre Neidhardt wrote:
> Can we merge this in core updates?
> Any blocker?
>
The wrapping is wrong at the very top, it should be under the 'e' in
define. It looks good. I didn't look too much at the logic (my weak
point) but this should be a very welcome addition.
Why core-updates specifically?
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.)
2019-10-12 18:44 ` Efraim Flashner
@ 2019-10-12 19:05 ` Pierre Neidhardt
2019-10-12 19:12 ` Efraim Flashner
0 siblings, 1 reply; 15+ messages in thread
From: Pierre Neidhardt @ 2019-10-12 19:05 UTC (permalink / raw)
To: Efraim Flashner
Cc: Marius Bakke, 36000, Ludovic Courtès, Nicolas Goaziou
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
Cc-ing Nicolas since he was part of the discussion:
https://lists.gnu.org/archive/html/guix-devel/2019-05/msg00404.html
Efraim Flashner <efraim@flashner.co.il> writes:
> The wrapping is wrong at the very top, it should be under the 'e' in
> define.
You mean the indentation? I'm not sure what's wrong, could you write a snippet?
> Why core-updates specifically?
Because this rebuilds the world :(
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.)
2019-10-12 19:05 ` Pierre Neidhardt
@ 2019-10-12 19:12 ` Efraim Flashner
2019-10-18 8:43 ` Pierre Neidhardt
0 siblings, 1 reply; 15+ messages in thread
From: Efraim Flashner @ 2019-10-12 19:12 UTC (permalink / raw)
To: Pierre Neidhardt
Cc: Marius Bakke, 36000, Ludovic Courtès, Nicolas Goaziou
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
On Sat, Oct 12, 2019 at 09:05:38PM +0200, Pierre Neidhardt wrote:
> Cc-ing Nicolas since he was part of the discussion:
> https://lists.gnu.org/archive/html/guix-devel/2019-05/msg00404.html
>
> Efraim Flashner <efraim@flashner.co.il> writes:
>
> > The wrapping is wrong at the very top, it should be under the 'e' in
> > define.
>
> You mean the indentation? I'm not sure what's wrong, could you write a snippet?
>
Yeah, I did mean indentation. I meant that it should be
(define* (...
next-line-here
but then I checked guix/build/utils and saw that all the other ones are
indented the way you have it so keep it :).
> > Why core-updates specifically?
>
> Because this rebuilds the world :(
>
Ah, that's unfortunate
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.)
2019-10-12 19:12 ` Efraim Flashner
@ 2019-10-18 8:43 ` Pierre Neidhardt
2019-10-18 14:40 ` Ludovic Courtès
2019-10-18 15:13 ` Marius Bakke
0 siblings, 2 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2019-10-18 8:43 UTC (permalink / raw)
To: Efraim Flashner
Cc: Marius Bakke, 36000, Ludovic Courtès, Nicolas Goaziou
[-- Attachment #1: Type: text/plain, Size: 86 bytes --]
So shall I merge it on staging then?
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.)
2019-10-18 8:43 ` Pierre Neidhardt
@ 2019-10-18 14:40 ` Ludovic Courtès
2019-10-18 15:10 ` Marius Bakke
2019-10-18 15:13 ` Marius Bakke
1 sibling, 1 reply; 15+ messages in thread
From: Ludovic Courtès @ 2019-10-18 14:40 UTC (permalink / raw)
To: Pierre Neidhardt; +Cc: Marius Bakke, 36000, Efraim Flashner, Nicolas Goaziou
Hi,
Pierre Neidhardt <mail@ambrevar.xyz> skribis:
> So shall I merge it on staging then?
I think ‘staging’ is in fact pretty much ready, no? Marius?
https://ci.guix.gnu.org/jobset/staging-staging
Ludo’.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.)
2019-10-18 8:43 ` Pierre Neidhardt
2019-10-18 14:40 ` Ludovic Courtès
@ 2019-10-18 15:13 ` Marius Bakke
2019-10-18 15:22 ` Pierre Neidhardt
1 sibling, 1 reply; 15+ messages in thread
From: Marius Bakke @ 2019-10-18 15:13 UTC (permalink / raw)
To: Pierre Neidhardt, Efraim Flashner
Cc: 36000, Ludovic Courtès, Nicolas Goaziou
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Pierre Neidhardt <mail@ambrevar.xyz> writes:
> So shall I merge it on staging then?
This is world-rebuilding change, no? In that case it has to go through
'core-updates' as per the branch rebuild policy:
https://guix.gnu.org/manual/en/guix.html#Submitting-Patches
(it would be good to shorten that section a bit...)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-10-19 10:47 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-30 7:11 [bug#36000] [PATCH 1/4] guix: Add helper for generating desktop entry files Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 2/4] gnu: emacs-exwm: Use make-desktop-entry-file Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 3/4] gnu: tome4: " Pierre Neidhardt
2019-05-30 8:17 ` [bug#36000] [PATCH 4/4] gnu: drascula: " Pierre Neidhardt
[not found] ` <handler.36000.B.155920231822519.ack@debbugs.gnu.org>
2019-10-12 8:43 ` [bug#36000] Acknowledgement ([PATCH 1/4] guix: Add helper for generating desktop entry files.) Pierre Neidhardt
2019-10-12 18:44 ` Efraim Flashner
2019-10-12 19:05 ` Pierre Neidhardt
2019-10-12 19:12 ` Efraim Flashner
2019-10-18 8:43 ` Pierre Neidhardt
2019-10-18 14:40 ` Ludovic Courtès
2019-10-18 15:10 ` Marius Bakke
2019-10-18 15:13 ` Marius Bakke
2019-10-18 15:22 ` Pierre Neidhardt
2019-10-18 15:24 ` Marius Bakke
2019-10-19 10:46 ` Pierre Neidhardt
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.