From 8c1b2e9c619e8721029219311f0a7706c0fe5037 Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Fri, 27 Jun 2025 20:18:29 +0800 Subject: [PATCH] =?UTF-8?q?utils:=20Add=20=E2=80=98hidden-desktop-entry?= =?UTF-8?q?=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * modules/rosenthal/utils/file.scm (hidden-desktop-entry): New procedure. --- modules/rosenthal/utils/file.scm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/rosenthal/utils/file.scm b/modules/rosenthal/utils/file.scm index e2a7013..3344d69 100644 --- a/modules/rosenthal/utils/file.scm +++ b/modules/rosenthal/utils/file.scm @@ -5,7 +5,11 @@ #:use-module (ice-9 textual-ports) #:use-module (guix gexp) #:export (computed-substitution-with-inputs - file-content)) + file-content + hidden-desktop-entry)) + +;; XXX: ‘substitute*’ doesn't fully support Unicode: +;; https://codeberg.org/guix/guix/src/commit/a88d6a45e422cede96d57d7a953439dc27c6a50c/guix/build/utils.scm#L964 (define (computed-substitution-with-inputs name file inputs) (with-imported-modules '((guix build utils)) @@ -20,3 +24,13 @@ (define (file-content file) (call-with-input-file (canonicalize-path file) get-string-all)) + +(define (hidden-desktop-entry name file) + (computed-file name + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (copy-file #$file #$output) + (substitute* #$output + (("[Desktop Entry]" all) + (string-append all "NoDisplay=true\n")))))))