From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?5a6L5paH5q2m?= Subject: Re: [PATCH] profiles: Add 'hicolor' and 'HighContrast' icon theme hooks. Date: Sat, 09 May 2015 13:11:03 +0800 Message-ID: <877fsixrmg.fsf@gmail.com> References: <1431147336-4274-1-git-send-email-iyzsong@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqx1w-0006ZX-St for guix-devel@gnu.org; Sat, 09 May 2015 01:10:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yqx1t-0006nq-Li for guix-devel@gnu.org; Sat, 09 May 2015 01:10:28 -0400 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]:36662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqx1t-0006na-EB for guix-devel@gnu.org; Sat, 09 May 2015 01:10:25 -0400 Received: by pabsx10 with SMTP id sx10so66191085pab.3 for ; Fri, 08 May 2015 22:10:24 -0700 (PDT) Received: from localhost ([108.61.250.36]) by mx.google.com with ESMTPSA id fm3sm6749037pdb.28.2015.05.08.22.10.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2015 22:10:23 -0700 (PDT) In-Reply-To: <1431147336-4274-1-git-send-email-iyzsong@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org This is WIP. > * guix/profiles.scm (gtk-icon-theme-hook): New function. > (%default-profile-hooks): Add `(gtk-icon-theme-hook "hicolor")' and > `(gtk-icon-theme-hook "HighContrast")'. > --- > guix/profiles.scm | 36 +++++++++++++++++++++++++++++++++++- > 1 file changed, 35 insertions(+), 1 deletion(-) > > diff --git a/guix/profiles.scm b/guix/profiles.scm > index 11d9bf0..9756685 100644 > --- a/guix/profiles.scm > +++ b/guix/profiles.scm > @@ -573,12 +573,46 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx." > #:modules '((guix build utils)) > #:local-build? #t)) > > +(define (gtk-icon-theme-hook name) > + "Return a profile hook that unions all NAME icons from manifest entries and > +rebuilds the 'icon-theme.cache' file for the NAME icon theme." > + (define gtk+ > + (module-ref (resolve-interface '(gnu packages gtk)) 'gtk+)) > + > + (lambda (manifest) > + (define build > + #~(begin > + (use-modules (guix build utils) > + (guix build union)) > + (let* ((icon-dir (lambda (base) > + (string-append base "/share/icons/" #$name))) > + (destdir (icon-dir #$output)) > + (icons (filter > + file-exists? > + (map icon-dir '#$(manifest-inputs manifest)))) > + (update-icon-cache (string-append > + #+gtk+ "/bin/gtk-update-icon-cache"))) > + ;; mkdir -p $out/share/icons > + (mkdir-p destdir) > + (rmdir destdir) > + ;; Unions all the icons and update the 'icon-theme.cache'. > + (union-build destdir icons) > + (system* update-icon-cache "-t" destdir)))) > + > + (gexp->derivation (string-append (string-downcase name) "-icon-theme") > + build > + #:modules '((guix build utils) > + (guix build union)) > + #:local-build? #t))) When to exclude this derivation? 1. the best would be whether icon dir exists or not but is this posibble to implement? and how? 2. whether we have a gtk+ package in profile And any better way? > + > (define %default-profile-hooks > ;; This is the list of derivation-returning procedures that are called by > ;; default when making a non-empty profile. > (list info-dir-file > ghc-package-cache-file > - ca-certificate-bundle)) > + ca-certificate-bundle > + (gtk-icon-theme-hook "hicolor") > + (gtk-icon-theme-hook "HighContrast"))) Does these 2 enough? I think in practical, it does. Or (better) as Federico Beffa said in: http://lists.gnu.org/archive/html/guix-devel/2015-01/msg00108.html We should rebuilds all the icon themes? If so, I think the code will be more complex... > > (define* (profile-derivation manifest > #:key > -- > 2.2.1