Subject: [PATCH] gnu: icewm: iAdd icewm.desktop file.

From: Andy Tai <[email-masked]>
Date: Sat, 8 Feb 2025 23:16:24 -0800

* gnu/packages/wm.scm (icewm): Add 'install-xsession phase that
  installs the icewm.desktop.file.

Change-Id: I94661ec15bccc3bcb1539a52c78cc303a4b5caf3
---
 gnu/packages/wm.scm | 55 ++++++++++++++++++++++++++++++---------------
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 8aa314e56b..7ce4bb9f34 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -1027,19 +1027,19 @@ (define-public icewm
   (package
     (name "icewm")
     (version "3.6.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://github.com/ice-wm/icewm/releases/download/"
-                    version "/icewm-" version ".tar.lz"))
-              (sha256
-               (base32
-                "0xmw4ilzsc932fxqahxvqix66x940nzf54p5mz5p67rplg9sz7wp"))))
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/ice-wm/icewm/releases/download/" version
+             "/icewm-" version ".tar.lz"))
+       (sha256
+        (base32 "0xmw4ilzsc932fxqahxvqix66x940nzf54p5mz5p67rplg9sz7wp"))))
     (build-system gnu-build-system)
     (native-inputs (list pkg-config))
     (inputs (list fontconfig
                   fribidi
-                  glib                  ;for icewm-menu-fdo
+                  glib ;for icewm-menu-fdo
                   imlib2
                   libice
                   libjpeg-turbo
@@ -1057,15 +1057,34 @@ (define-public icewm
                   lzip
                   perl))
     (arguments
-     (list #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'unpack 'skip-failing-test
-                 ;; strtest.cc tests failing due to $HOME and /etc setup
-                 ;; difference under guix
-                 (lambda _
-                   (substitute* "src/Makefile.in"
-                     (("TESTS = strtest\\$\\(EXEEXT\\)")
-                      "TESTS = ")))))))
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'skip-failing-test
+                     ;; strtest.cc tests failing due to $HOME and /etc setup
+                     ;; difference under guix
+                     (lambda _
+                       (substitute* "src/Makefile.in"
+                         (("TESTS = strtest\\$\\(EXEEXT\\)")
+                          "TESTS = "))))
+                   (add-after 'install 'install-xsession
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       ;; Add a .desktop file to xsessions.
+                       (let* ((output (assoc-ref outputs "out"))
+                              (xsessions (string-append output
+                                                        "/share/xsessions")))
+                         (mkdir-p xsessions)
+                         (call-with-output-file (string-append xsessions
+
+                                                 "/icewm.desktop")
+                           (lambda (port)
+                             (format port
+                              "[Desktop Entry]~@
+                            Name=icewm~@
+                            Comment=IceWM window manager~@
+                            Exec=~a/bin/icewm~@
+                            TryExec=~@*~a/bin/icewm~@
+                            Type=Application~%"
+                              output)))))))))
     (home-page "https://ice-wm.org/")
     (synopsis "Window manager for the X Window System")
     (description

base-commit: fd3876ec2a47909eac8e7fa0f24710a94ccb1459
-- 
2.46.0