~ruther/guix-config

bdfdb4673eadcd4d7459a44af3e59f2c397a54fd — Rutherther 7 months ago 1e61c62
feat: add gtk theme
M home/home-configuration.scm => home/home-configuration.scm +13 -3
@@ 4,19 4,22 @@
;; need to capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.

(use-modules (gnu home)
(use-modules (guix packages)
             (guix gexp)
             (gnu home)
             (gnu packages)
             (gnu packages gnupg)
             (gnu packages shellutils)
             (gnu services)
             (guix gexp)
             (gnu home services fontutils)
             (gnu home services desktop)
             (gnu home services shells)
             (gnu home services gnupg)
             (gnu home services sound)
             (gnu home services)
             (ruther home dwl wm))
             (ruther home dwl wm)
             (ruther home themes)
             (ruther home services gtk))

(home-environment
 ;; Below is the list of packages that will show up in your


@@ 83,6 86,13 @@
                   (bash-profile (list (local-file "dotfiles/.bash_profile"
                                                   "bash_profile")))))

         (service home-gtk-service-type
                  (let ((theme (make-graphite-gtk-theme #:theme "orange" #:color "dark")))
                    (home-gtk-configuration
                     (theme-package theme)
                     (theme-name (assoc-ref (package-properties theme) 'theme-name))
                     (font-name "Ubuntu 12"))))

         (service home-zsh-service-type
                  (home-zsh-configuration
                   (zshrc (list

A home/modules/ruther/home/services/gtk.scm => home/modules/ruther/home/services/gtk.scm +93 -0
@@ 0,0 1,93 @@
(define-module (ruther home services gtk)
  #:use-module (gnu services configuration)
  #:use-module (gnu services)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  #:use-module (gnu home services)
  #:export (home-gtk-configuration
            home-gtk-service-type))

(define (serialize-string name value)
  (format #f "~a=~a~%" name value))
;; So... it will make the gtk files
;;
;; ~/.gtkrc-2.0

;; gtk-icon-theme-name = theme-name
;; gtk-theme-name = theme-name
;; gtk-font-name = font-name


;; $XDG_CONFIG_HOME/gtk-3.0/settings.ini

;; [Settings]
;; gtk-icon-theme-name = theme-name
;; gtk-theme-name = theme-name
;; gtk-font-name = font-name
;; (gtk-config-file )

(define (gtk2-config-file name theme font)
  `(,name
    "gtk-icon-theme-name = \"" ,theme "\"\n"
    "gtk-theme-name = \"" ,theme "\"\n"
    "gtk-font-name = \"" ,font "\"\n"))

(define (gtk-config-file name prefix theme font)
  `(,name
    "[Settings]\n"
    "gtk-icon-theme-name = " ,theme "\n"
    "gtk-theme-name = " ,theme "\n"
    "gtk-font-name = " ,font "\n"))

(define (gtk4-css-import-file theme-package theme-name)
  `("gtk.css"
    "@import url(\"file://" ,theme-package "/share/themes/" ,theme-name "/gtk-4.0/gtk.css\");"))

(define-configuration home-gtk-configuration
  (theme-package
   package
   "The package with theme under share/themes/{theme-name}")
  (theme-name
   string
   "The name of the theme in the package")
  (font-name
   (string "DejaVu Sans 12")
   "Name of the font to use"))

(define (add-gtk-theme-package config)
  (list
   (home-gtk-configuration-theme-package config)))

(define (add-gtk-config-file config)
  `((".gtkrc-2.0"
     ,(apply mixed-text-file (gtk2-config-file
                              "gtkrc-2.0"
                              (home-gtk-configuration-theme-name config)
                              (home-gtk-configuration-font-name config))))
    (".config/gtk-3.0/settings.ini"
     ,(apply mixed-text-file (gtk-config-file
                              "settings.ini"
                              "[Settings]"
                              (home-gtk-configuration-theme-name config)
                              (home-gtk-configuration-font-name config))))
    (".config/gtk-4.0/settings.ini"
     ,(apply mixed-text-file (gtk-config-file
                              "settings.ini"
                              "[Settings]"
                              (home-gtk-configuration-theme-name config)
                              (home-gtk-configuration-font-name config))))
    (".config/gtk-4.0/gtk.css"
     ,(apply mixed-text-file (gtk4-css-import-file
                              (home-gtk-configuration-theme-package config)
                              (home-gtk-configuration-theme-name config))))))

(define-public home-gtk-service-type
  (service-type (name 'home-gtk)
                (extensions
                 (list (service-extension
                        home-files-service-type
                        add-gtk-config-file)
                       (service-extension
                        home-profile-service-type
                        add-gtk-theme-package)))
                (description "Create gtk theme configuration files for gtk2 and gtk3")))

A home/modules/ruther/home/themes.scm => home/modules/ruther/home/themes.scm +83 -0
@@ 0,0 1,83 @@
(define-module (ruther home themes)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages web)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix build utils)
  #:use-module (guix gexp)
  #:use-module (guix build-system gnu)
  #:use-module (guix download)
  #:use-module (guix git-download)

  #:export (make-graphite-gtk-theme))

; (make-graphite-theme #:theme "orange" #:color "dark")
(define* (make-graphite-gtk-theme #:key
                              theme
                              (color "standard")
                              (size "standard"))
  (package
    (name (string-append "graphite-" theme "-" color "-" size "-theme"))
    (version "2024-07-15")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/vinceliuice/Graphite-gtk-theme")
             (commit version)))
       (sha256
        (base32 "1fmbfyf5j9mi31r84x8vb1z82jfg9cqcg27q7n579l65n3zybpck"))))
    (build-system gnu-build-system)
    (inputs
     (list gnome-themes-extra))
    (native-inputs
     (list sassc))
    (properties
     `((theme-name . ,(string-append "Graphite-" theme "-" (string-titlecase color)))))
    (arguments
     `(#:phases (modify-phases %standard-phases
                  (delete 'configure)
                  (delete 'build)
                  (delete 'check)
                  (replace 'install
                    (lambda* (#:key inputs outputs #:allow-other-keys)
                      (invoke
                       "bash"
                       "install.sh"
                       "-t" ,theme
                       "-c" ,color
                       "-d" (string-append (assoc-ref %outputs "out") "/share/themes"))
                      )))))
    ;; (arguments
    ;;  (list
    ;;   #:builder
    ;;   (with-imported-modules '((guix build utils))
    ;;     #~(begin
    ;;         (use-modules (guix build utils))
    ;;         ;; (setenv "PATH" (string-join (map (lambda (x) (string-append (cdr x) "/bin")) %build-inputs) ":"))
    ;;         (display (invoke "ls"))
    ;;         (invoke "bash" "install.sh")))
    ;;   ;; (with-imported-modules '((guix build utils))

    ;;   ;;   ;; #~(begin
    ;;   ;;   ;;     (use-modules (guix build utils))

    ;;   ;;   ;;     #$(with-build-variables #$inputs #$outputs
    ;;   ;;   ;;         (setenv "PATH" (string-join (map (lambda (x) (string-append x "/bin")) %build-inputs)) ":")
    ;;   ;;   ;;         (invoke "bash"
    ;;   ;;   ;;                 "-t" #$theme
    ;;   ;;   ;;                 "-c" #$color
    ;;   ;;   ;;                 "install.sh"
    ;;   ;;   ;;                 "-d" (string-append #$output "/share/themes")))
    ;;   ;;   ;;     )
    ;;   ;;   )
    ;;   ))
    (synopsis "Graphite gtk theme")
    (description "Graphite gtk theme")
    (home-page "https://github.com/vinceliuice/Graphite-gtk-theme")
    (license license:gpl3)))

;; (make-graphite-gtk-theme #:theme "orange" #:color "dark")

Do not follow this link