From bd96a46416788daa9b53d50230f690dbc5991739 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Tue, 15 Aug 2023 18:05:07 -0400 Subject: [PATCH] rosenthal: Add xdg-desktop-portal-hyprland * rosenthal/packages/wm.scm (xdg-desktop-portal-hyprland): New variable. Signed-off-by: Hilton Chain --- rosenthal/packages/wm.scm | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/rosenthal/packages/wm.scm b/rosenthal/packages/wm.scm index 4e8ea66..ca9bdde 100644 --- a/rosenthal/packages/wm.scm +++ b/rosenthal/packages/wm.scm @@ -6,21 +6,28 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system gnu) #:use-module (guix build-system meson) + #:use-module (guix build-system qt) #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages autotools) + #:use-module (gnu packages bash) + #:use-module (gnu packages cmake) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages gcc) + #:use-module (gnu packages gl) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages image) + #:use-module (gnu packages linux) #:use-module (gnu packages man) #:use-module (gnu packages pciutils) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) + #:use-module (gnu packages qt) #:use-module (gnu packages web) #:use-module (gnu packages wm) #:use-module (gnu packages xdisorg) @@ -250,3 +257,76 @@ customization, and more.") (synopsis "Hyprland version of Grimshot") (description "A Hyprland version of Grimshot.") (license license:expat))) + +(define-public xdg-desktop-portal-hyprland + (package + (name "xdg-desktop-portal-hyprland") + (version "0.5.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/hyprwm/xdg-desktop-portal-hyprland") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1dmgc0w4wjj9hwqg17wg529v8sbxr6czp9s319d5407jm780x40b")))) + (build-system meson-build-system) + (arguments + (list #:imported-modules + (append %meson-build-system-modules + %qt-build-system-modules) + #:modules + '((guix build utils) + (guix build meson-build-system) + ((guix build qt-build-system) #:prefix qt:)) + #:tests? #f ;No tests + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-path + (lambda* (#:key inputs #:allow-other-keys) + (substitute* (find-files "." "\\.cp?*$") + (("/bin/sh") "sh") + (("\\<(sh|grim|slurp)\\>" _ cmd) + (search-input-file inputs (string-append "/bin/" cmd))) + (("\"(hyprland-share-picker)\"" _ cmd) + (string-append "\"" #$output "/bin/" cmd "\""))))) + ;; After building the portal, we need to build the share selector + ;; using qt + (add-after 'install 'chdir + (lambda _ + (chdir "../source/hyprland-share-picker/"))) + (add-after 'chdir 'qt-build + (lambda* (#:key (make-flags '()) (parallel-build? #t) + #:allow-other-keys) + ((assoc-ref qt:%standard-phases 'build) + #:make-flags make-flags + #:parallel-build? parallel-build?))) + (add-after 'qt-build 'install-hyprland-share-picker + (lambda _ + (install-file "build/hyprland-share-picker" + (string-append #$output "/bin")))) + (add-after 'install-hyprland-share-picker 'qt-wrap + (assoc-ref qt:%standard-phases 'qt-wrap))))) + (native-inputs (list cmake-minimal pkg-config)) + (inputs + (list bash-minimal + basu + grim + hyprland-protocols + libinih + mesa + pipewire + qtbase-5 + slurp + `(,util-linux "lib") + wayland + wayland-protocols)) + (home-page "https://github.com/hyprwm/xdg-desktop-portal-hyprland") + (synopsis "XDG Desktop Portal backend for Hyprland") + (description + "This package provides @code{xdg-desktop-portal-hyprland}, which extends +@code{xdg-desktop-portal-wlr} for Hyprland with support for +@code{xdg-desktop-portal} screenshot and casting interfaces, while adding a few +extra portals specific to Hyprland, mostly for window sharing.") + (license license:expat)))