From 820cbff8e27ca05125a31a5f9203966b59fb8763 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Sun, 10 Mar 2024 21:36:20 +0100 Subject: Generate PNG desktop background directly This avoids having to copy the image to different machines. --- tw/home/btl.scm | 1 - tw/home/cern.scm | 1 - tw/home/frm.scm | 1 - tw/home/lap.scm | 1 - tw/packages/catppuccin.scm | 25 +++++++++++++++++++++++++ tw/services/desktop.scm | 5 +++-- 6 files changed, 28 insertions(+), 6 deletions(-) (limited to 'tw') diff --git a/tw/home/btl.scm b/tw/home/btl.scm index f4ed9d90..dae44c86 100644 --- a/tw/home/btl.scm +++ b/tw/home/btl.scm @@ -52,7 +52,6 @@ (home-desktop-configuration (gaming? #t) (bluetooth? #t) - (desktop-background "~/blobs-d.png") (monitors (list (home-monitor-configuration (name "DisplayPort-2") diff --git a/tw/home/cern.scm b/tw/home/cern.scm index b7e04ef5..a9e00d06 100644 --- a/tw/home/cern.scm +++ b/tw/home/cern.scm @@ -52,7 +52,6 @@ (service home-desktop-service-type (home-desktop-configuration - (desktop-background "~/.config/X11/ridge-view.jpg") (monitors (list (home-monitor-configuration (name "DP-2") diff --git a/tw/home/frm.scm b/tw/home/frm.scm index bf263679..d7759940 100644 --- a/tw/home/frm.scm +++ b/tw/home/frm.scm @@ -56,7 +56,6 @@ (service home-desktop-service-type (home-desktop-configuration (bluetooth? #t) - (desktop-background "~/blobs-d.png") (battery-name "BAT1") (ac-adapter-name "ACAD") (monitors diff --git a/tw/home/lap.scm b/tw/home/lap.scm index 959691aa..4a81be37 100644 --- a/tw/home/lap.scm +++ b/tw/home/lap.scm @@ -100,7 +100,6 @@ (gaming? #t) (nvidia-driver? #t) (bluetooth? #t) - (desktop-background "~/pictures/Backgrounds/greece/IMG_20181201_104748_DRO.jpg") (battery-name "BAT0") (ac-adapter-name "AC") (monitors diff --git a/tw/packages/catppuccin.scm b/tw/packages/catppuccin.scm index b2644147..e79c6be2 100644 --- a/tw/packages/catppuccin.scm +++ b/tw/packages/catppuccin.scm @@ -4,6 +4,8 @@ #:select (coreutils gnu-make findutils sed (which . which-package))) #:use-module (gnu packages bash) #:use-module (gnu packages gawk) + #:use-module ((gnu packages gnome) + #:select (gnome-backgrounds)) #:use-module (gnu packages gnome-xyz) #:use-module (gnu packages gtk) #:use-module (gnu packages inkscape) @@ -19,6 +21,7 @@ #:use-module (guix build-system qt) #:use-module (guix build-system trivial) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages)) @@ -234,3 +237,25 @@ Catppuccin color palette.")) #:commit "1bda9d8274dd327b7931886ef0c5c1eb33903814" #:repo-hash "104qmrmb249ly2zp797m652bgsvs09q22p65a73lz0fmv7k9qqqx" #:install-plan '(("src/" "share/catppuccin/zathura/")))) + +(define-public tw-background + (package + (name "tw-background") + (version "1") + (source #f) + (build-system trivial-build-system) + (arguments + `(#:builder + ,(with-imported-modules '((guix build utils)) + #~(let* ((out-dir (string-append #$output "/share/backgrounds/tw")) + (out-img (string-append out-dir "/blobs.png"))) + (use-modules (guix build utils)) + (mkdir-p out-dir) + (invoke #+(file-append inkscape "/bin/inkscape") "-C" "-o" out-img + #+(file-append gnome-backgrounds "/share/backgrounds/gnome/blobs-d.svg")))))) + (native-inputs (list gnome-backgrounds inkscape)) + (home-page #f) + (synopsis "My chosen desktop background image") + (description "This package definition generates a rasterised version of my +chosen desktop background image from @code{gnome-backgrounds}.") + (license (package-license gnome-backgrounds)))) diff --git a/tw/services/desktop.scm b/tw/services/desktop.scm index af728056..14739b2b 100644 --- a/tw/services/desktop.scm +++ b/tw/services/desktop.scm @@ -93,8 +93,9 @@ configure this monitor.")) (gaming? (boolean #f) "Install games and other packages useful for gaming?") (nvidia-driver? (boolean #f) "Adapt the X11 desktop for the proprietary NVIDIA driver?") - (desktop-background string "Path to an image that will be set as the desktop -background. An initial @code{~/} is replaced with $HOME/.") + (desktop-background + (file-like (file-append tw-background "/share/backgrounds/tw/blobs.png")) + "An image that will be set as the desktop background.") (bluetooth? (boolean #f) "Whether the device has Bluetooth hardware. If true, configure the user interface to use it.") (battery-name maybe-string "The device name of the system's battery, if any. -- cgit v1.2.3