diff options
author | Andrew Tropin <andrew@trop.in> | 2022-03-29 12:47:39 +0300 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-04-08 20:13:48 +0200 |
commit | 20645d8467852990413c1ea9cf81cec82d23defd (patch) | |
tree | b09c8315c7f3709d01559f05bfc5a94fd40a51a3 /gnu/home/services | |
parent | 5832d9fb601c7d4ec5380654db2b62b906bc658f (diff) | |
download | guix-20645d8467852990413c1ea9cf81cec82d23defd.tar.gz |
home: Add home-xdg-data-files-service-type.
* gnu/home/services.scm (home-xdg-data-files-service-type): New variable. * gnu/home/services/symlink-manager.scm (update-symlinks-script): Add a proper handling for XDG_DATA_HOME value. * gnu/home/services/xdg.scm (home-xdg-mime-applications-service-type): Use home-xdg-data-files service. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/home/services')
-rw-r--r-- | gnu/home/services/symlink-manager.scm | 25 | ||||
-rw-r--r-- | gnu/home/services/xdg.scm | 5 |
2 files changed, 21 insertions, 9 deletions
diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index b7a66c5518..24d21bfad3 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -54,6 +54,10 @@ (or (getenv "XDG_CONFIG_HOME") (string-append (getenv "HOME") "/.config"))) + (define xdg-data-home + (or (getenv "XDG_DATA_HOME") + (string-append (getenv "HOME") "/.local/share"))) + (define backup-directory (string-append home-directory "/" (number->string (current-time)) "-guix-home-legacy-configs-backup")) @@ -61,13 +65,20 @@ (define (preprocess-file file) "If file is in XDG-CONFIGURATION-FILES-DIRECTORY use subdirectory from XDG_CONFIG_HOME to generate a target path." - (if (string-prefix? #$xdg-configuration-files-directory file) - (string-append - (substring xdg-config-home - (1+ (string-length home-directory))) - (substring file - (string-length #$xdg-configuration-files-directory))) - file)) + (cond + ((string-prefix? #$xdg-configuration-files-directory file) + (string-append + (substring xdg-config-home + (1+ (string-length home-directory))) + (substring file + (string-length #$xdg-configuration-files-directory)))) + ((string-prefix? #$xdg-data-files-directory file) + (string-append + (substring xdg-data-home + (1+ (string-length home-directory))) + (substring file + (string-length #$xdg-data-files-directory)))) + (else file))) (define (target-file file) ;; Return the target of FILE, a config file name sans leading dot diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm index 3b504d7d09..71c028c788 100644 --- a/gnu/home/services/xdg.scm +++ b/gnu/home/services/xdg.scm @@ -421,7 +421,8 @@ that the application cannot open the specified MIME type.") (define (add-xdg-desktop-entry-file entry) (let ((file (first entry)) (config (second entry))) - (list (format #f ".local/share/applications/~a" file) + ;; TODO: Use xdg-data-files instead of home-files here + (list (format #f "applications/~a" file) (apply mixed-text-file (format #f "xdg-desktop-~a-entry" file) config)))) @@ -468,7 +469,7 @@ that the application cannot open the specified MIME type.") (service-type (name 'home-xdg-mime-applications) (extensions (list (service-extension - home-files-service-type + home-xdg-data-files-service-type home-xdg-mime-applications-files) (service-extension home-xdg-configuration-files-service-type |