;;; Copyright © 2025 bdunahu ;;; ;;; SPDX-License-Identifier: GPL-3.0-or-later (define-module (tanelorn packages wm) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system cargo) #:use-module (guix git-download) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix utils) #:use-module (tanelorn packages) #:use-module (tanelorn packages rust-crates) #:use-module (gnu packages glib) #:use-module (gnu packages gtk) #:use-module (gnu packages pkg-config)) (define-public eww (let ((commit "fddb4a09b107237819e661151e007b99b5cab36d") (revision "1")) (package (name "eww") (version (git-version "0.6.0" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/elkowar/eww") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "0ihgcxppywpcp24zhws1if6h7cxbrq2vd53wyh36j5mxylpbi59w")) (modules '((guix build utils))) ;; Remove the default features directly so that we can build ;; the x11 and wayland packages without all dependencies, ;; thus reducing the package size for those variants. (snippet '(substitute* "crates/eww/Cargo.toml" (("^default =.*") ""))))) (build-system cargo-build-system) (arguments `(#:install-source? #f #:features '("x11" "wayland") #:cargo-install-paths '("crates/eww"))) (inputs (cons* glib gdk-pixbuf gtk+ gtk-layer-shell libdbusmenu (tanelorn-cargo-inputs 'eww))) (native-inputs (list pkg-config)) (home-page "https://elkowar.github.io/eww") (synopsis "Widget system that works in any window manager") (description "Eww (Elkowars Wacky Widgets) is a standalone widget system made in Rust that allows you to implement your own, custom widgets in any window manager. Configured in yuck, a language based around S-expressions and themed using CSS, it is easy to customize and provides all the flexibility you need.") (license license:expat)))) (define-public eww/x11 (package/inherit eww (name "eww-x11") (inputs (modify-inputs (package-inputs eww) (delete "gtk-layer-shell"))) (arguments (substitute-keyword-arguments (package-arguments eww) ((#:cargo-test-flags flags ''()) `(cons* "--features=x11" ,flags)) ((#:features _ ''()) `(list "x11")))))) (define-public eww/wayland (package/inherit eww (name "eww-wayland") (arguments (substitute-keyword-arguments (package-arguments eww) ((#:cargo-test-flags flags ''()) `(cons* "--features=wayland" ,flags)) ((#:features _ ''()) `(list "wayland"))))))