From 959fe7ea8bc746763718210fb8ab77089010cc2e 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. --- rosenthal/packages/wm.scm | 88 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/rosenthal/packages/wm.scm b/rosenthal/packages/wm.scm index 4e8ea66..ad021b1 100644 --- a/rosenthal/packages/wm.scm +++ b/rosenthal/packages/wm.scm @@ -6,6 +6,7 @@ #: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) @@ -25,6 +26,12 @@ #:use-module (gnu packages wm) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xorg) + #:use-module (gnu packages freedesktop) + #:use-module (gnu packages linux) + #:use-module (gnu packages gl) + #:use-module (gnu packages qt) + #:use-module (gnu packages cmake) + #:use-module (gnu packages bash) #:use-module (rosenthal packages freedesktop) #:use-module (rosenthal packages xdisorg)) @@ -250,3 +257,84 @@ 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 #:modules '((guix build utils) + (guix build meson-build-system) + ((guix build qt-build-system) + #:prefix qt:)) + #:imported-modules (append %meson-build-system-modules + %qt-build-system-modules) + #:tests? #f + #:configure-flags #~(list "-Dsystemd=disabled") + #:phases + ;; After building the portal, we need to build the share selector using qt + #~(modify-phases %standard-phases + (add-after 'install 'chdir + (lambda _ + (chdir "../source/hyprland-share-picker/"))) + (add-after 'chdir 'check-setup + (assoc-ref qt:%standard-phases + 'check-setup)) + (add-after 'check-setup 'qt-build + (lambda* (#:key inputs outputs #:allow-other-keys) + ((assoc-ref qt:%standard-phases + 'build) + #:inputs inputs + #:outputs outputs + #:configure-flags '() + #:qtbase #$(this-package-native-input "qtbase-5")))) + (add-after 'qt-build 'qt-install + (lambda* (#:key inputs outputs #:allow-other-keys) + (install-file "build/hyprland-share-picker" + (string-append #$output "/bin")))) + (add-after 'qt-install 'qt-wrap + (assoc-ref qt:%standard-phases + 'qt-wrap)) + (add-after 'qt-wrap 'dep-wrap + (lambda* (#:key inputs #:allow-other-keys) + (let ((hyprland-share-picker (string-append #$output + "/bin/hyprland-share-picker"))) + (wrap-program hyprland-share-picker + `("PATH" suffix + ,(map (lambda (program) + (dirname (search-input-file inputs + (string-append + "/bin/" program)))) + '("slurp")))))))))) + (native-inputs (list cmake pkg-config qtbase-5)) + (inputs (list elogind + hyprland + hyprland-protocols + slurp + pipewire + wayland-protocols + wayland + libinih + mesa + qtwayland-5 + `(,util-linux "lib") + bash-minimal)) + (home-page "https://github.com/hyprwm/xdg-desktop-portal-hyprland") + (synopsis "@code{xdg-desktop-portal} backend for Hyprland") + (description + "This package provides @code{xdg-desktop-portal-hyprland}. This project +extends @code{xdg-desktop-portal-wlr} for Hyprland, adding 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)))