Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package xdg-desktop-portal-hyprland for openSUSE:Factory checked in at 2025-06-23 15:02:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xdg-desktop-portal-hyprland (Old) and /work/SRC/openSUSE:Factory/.xdg-desktop-portal-hyprland.new.7067 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xdg-desktop-portal-hyprland" Mon Jun 23 15:02:29 2025 rev:16 rq:1287547 version:1.3.9 Changes: -------- --- /work/SRC/openSUSE:Factory/xdg-desktop-portal-hyprland/xdg-desktop-portal-hyprland.changes 2024-12-13 22:40:35.939720987 +0100 +++ /work/SRC/openSUSE:Factory/.xdg-desktop-portal-hyprland.new.7067/xdg-desktop-portal-hyprland.changes 2025-06-23 15:02:57.800005305 +0200 @@ -1,0 +2,12 @@ +Sat Jun 21 09:27:18 UTC 2025 - Soc Virnyl Estela <uncomfyhaloma...@opensuse.org> + +- Update to version 1.3.9: + * config: add screencopy:custom_picker_binary + * core: move to CProcess from hyprutils + * nix: package: replace sdbus-cpp with sdbus-cpp_2 + * gitignore: add nix result and result-man + * housekeeping: nix/overlays.nix + * use stable/linux-dmabuf-v1 instead of unstable/linux-dmabuf-unstable-v1 + * nix/overlays: gcc13 -> gcc14 + +------------------------------------------------------------------- Old: ---- xdg-desktop-portal-hyprland-1.3.8.tar.gz New: ---- xdg-desktop-portal-hyprland-1.3.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xdg-desktop-portal-hyprland.spec ++++++ --- /var/tmp/diff_new_pack.KCguD9/_old 2025-06-23 15:02:58.396029519 +0200 +++ /var/tmp/diff_new_pack.KCguD9/_new 2025-06-23 15:02:58.396029519 +0200 @@ -1,7 +1,7 @@ # # spec file for package xdg-desktop-portal-hyprland # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global __builder ninja Name: xdg-desktop-portal-hyprland -Version: 1.3.8 +Version: 1.3.9 Release: 0 Summary: Extended xdg-desktop-portal backend for Hyprland License: MIT ++++++ xdg-desktop-portal-hyprland-1.3.8.tar.gz -> xdg-desktop-portal-hyprland-1.3.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/.gitignore new/xdg-desktop-portal-hyprland-1.3.9/.gitignore --- old/xdg-desktop-portal-hyprland-1.3.8/.gitignore 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/.gitignore 2024-12-19 01:48:58.000000000 +0100 @@ -51,14 +51,21 @@ Mkfile.old dkms.conf -# build folder +# Build folders build/ build-*/ - -.cache -.vscode/ - hyprland-share-picker/build/ +# Generated code files protocols/*.c* -protocols/*.h* \ No newline at end of file +protocols/*.h* + +# Nix build results +result +result-man + +# Code editors +.vscode/ + +# MISCELLANEOUS +.cache diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/CMakeLists.txt new/xdg-desktop-portal-hyprland-1.3.9/CMakeLists.txt --- old/xdg-desktop-portal-hyprland-1.3.8/CMakeLists.txt 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/CMakeLists.txt 2024-12-19 01:48:58.000000000 +0100 @@ -64,7 +64,7 @@ libdrm gbm hyprlang>=0.2.0 - hyprutils + hyprutils>=0.2.6 hyprwayland-scanner>=0.4.2) # check whether we can find sdbus-c++ through pkg-config @@ -130,7 +130,7 @@ true) protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-toplevel-export-v1" true) -protocolnew("unstable/linux-dmabuf" "linux-dmabuf-unstable-v1" false) +protocolnew("stable/linux-dmabuf" "linux-dmabuf-v1" false) # Installation install(TARGETS hyprland-share-picker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/VERSION new/xdg-desktop-portal-hyprland-1.3.9/VERSION --- old/xdg-desktop-portal-hyprland-1.3.8/VERSION 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/VERSION 2024-12-19 01:48:58.000000000 +0100 @@ -1 +1 @@ -1.3.8 +1.3.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/flake.lock new/xdg-desktop-portal-hyprland-1.3.9/flake.lock --- old/xdg-desktop-portal-hyprland-1.3.8/flake.lock 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/flake.lock 2024-12-19 01:48:58.000000000 +0100 @@ -10,11 +10,11 @@ ] }, "locked": { - "lastModified": 1721326555, - "narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=", + "lastModified": 1728345020, + "narHash": "sha256-xGbkc7U/Roe0/Cv3iKlzijIaFBNguasI31ynL2IlEoM=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84", + "rev": "a7c183800e74f337753de186522b9017a07a8cee", "type": "github" }, "original": { @@ -25,7 +25,9 @@ }, "hyprlang": { "inputs": { - "hyprutils": "hyprutils", + "hyprutils": [ + "hyprutils" + ], "nixpkgs": [ "nixpkgs" ], @@ -34,11 +36,11 @@ ] }, "locked": { - "lastModified": 1725997860, - "narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=", + "lastModified": 1734364628, + "narHash": "sha256-ii8fzJfI953n/EmIxVvq64ZAwhvwuuPHWfGd61/mJG8=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876", + "rev": "16e59c1eb13d9fb6de066f54e7555eb5e8a4aba5", "type": "github" }, "original": { @@ -50,31 +52,6 @@ "hyprutils": { "inputs": { "nixpkgs": [ - "hyprlang", - "nixpkgs" - ], - "systems": [ - "hyprlang", - "systems" - ] - }, - "locked": { - "lastModified": 1721324102, - "narHash": "sha256-WAZ0X6yJW1hFG6otkHBfyJDKRpNP5stsRqdEuHrFRpk=", - "owner": "hyprwm", - "repo": "hyprutils", - "rev": "962582a090bc233c4de9d9897f46794280288989", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprutils", - "type": "github" - } - }, - "hyprutils_2": { - "inputs": { - "nixpkgs": [ "nixpkgs" ], "systems": [ @@ -82,11 +59,11 @@ ] }, "locked": { - "lastModified": 1724966483, - "narHash": "sha256-WXDgKIbzjYKczxSZOsJplCS1i1yrTUpsDPuJV/xpYLo=", + "lastModified": 1733502241, + "narHash": "sha256-KAUNC4Dgq8WQjYov5auBw/usaHixhacvb7cRDd0AG/k=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "8976e3f6a5357da953a09511d0c7f6a890fb6ec2", + "rev": "104117aed6dd68561be38b50f218190aa47f2cd8", "type": "github" }, "original": { @@ -105,11 +82,11 @@ ] }, "locked": { - "lastModified": 1726840673, - "narHash": "sha256-HIPEXyRRVZoqD6U+lFS1B0tsIU7p83FaB9m7KT/x6mQ=", + "lastModified": 1726874836, + "narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "b68dab23fc922eae99306988133ee80a40b39ca5", + "rev": "500c81a9e1a76760371049a8d99e008ea77aa59e", "type": "github" }, "original": { @@ -120,11 +97,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726463316, - "narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=", + "lastModified": 1734119587, + "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172", + "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", "type": "github" }, "original": { @@ -138,7 +115,7 @@ "inputs": { "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang", - "hyprutils": "hyprutils_2", + "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": "nixpkgs", "systems": "systems" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/flake.nix new/xdg-desktop-portal-hyprland-1.3.9/flake.nix --- old/xdg-desktop-portal-hyprland-1.3.8/flake.nix 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/flake.nix 2024-12-19 01:48:58.000000000 +0100 @@ -15,6 +15,7 @@ hyprlang = { url = "github:hyprwm/hyprlang"; + inputs.hyprutils.follows = "hyprutils"; inputs.nixpkgs.follows = "nixpkgs"; inputs.systems.follows = "systems"; }; @@ -49,7 +50,7 @@ overlays = import ./nix/overlays.nix {inherit self inputs lib;}; packages = eachSystem (system: { - inherit (pkgsFor.${system}) xdg-desktop-portal-hyprland; + inherit (pkgsFor.${system}) xdg-desktop-portal-hyprland sdbus-cpp_2; default = self.packages.${system}.xdg-desktop-portal-hyprland; }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/hyprland-share-picker/CMakeLists.txt new/xdg-desktop-portal-hyprland-1.3.9/hyprland-share-picker/CMakeLists.txt --- old/xdg-desktop-portal-hyprland-1.3.8/hyprland-share-picker/CMakeLists.txt 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/hyprland-share-picker/CMakeLists.txt 2024-12-19 01:48:58.000000000 +0100 @@ -17,6 +17,13 @@ find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets) find_package(Qt6 REQUIRED COMPONENTS Widgets) +find_package(PkgConfig REQUIRED) +pkg_check_modules( + deps + REQUIRED + IMPORTED_TARGET + hyprutils>=0.2.6) + set(PROJECT_SOURCES main.cpp mainpicker.cpp mainpicker.h mainpicker.ui elidedbutton.h elidedbutton.cpp) @@ -38,7 +45,7 @@ endif() target_link_libraries(hyprland-share-picker - PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) + PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PkgConfig::deps) set_target_properties( hyprland-share-picker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/hyprland-share-picker/main.cpp new/xdg-desktop-portal-hyprland-1.3.9/hyprland-share-picker/main.cpp --- old/xdg-desktop-portal-hyprland-1.3.8/hyprland-share-picker/main.cpp 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/hyprland-share-picker/main.cpp 2024-12-19 01:48:58.000000000 +0100 @@ -15,21 +15,20 @@ #include <stdexcept> #include <string> #include <vector> +#include <hyprutils/os/Process.hpp> +using namespace Hyprutils::OS; #include "mainpicker.h" #include "elidedbutton.h" std::string execAndGet(const char* cmd) { - std::array<char, 128> buffer; - std::string result; - std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose); - if (!pipe) { - throw std::runtime_error("popen() failed!"); - } - while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { - result += buffer.data(); - } - return result; + std::string command = cmd + std::string{" 2>&1"}; + CProcess proc("/bin/sh", {"-c", cmd}); + + if (!proc.runSync()) + return "error"; + + return proc.stdOut(); } QApplication* pickerPtr = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/nix/default.nix new/xdg-desktop-portal-hyprland-1.3.9/nix/default.nix --- old/xdg-desktop-portal-hyprland-1.3.8/nix/default.nix 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/nix/default.nix 2024-12-19 01:48:58.000000000 +0100 @@ -16,7 +16,7 @@ qtbase, qttools, qtwayland, - sdbus-cpp, + sdbus-cpp_2, slurp, systemd, wayland, @@ -53,7 +53,7 @@ qtbase qttools qtwayland - sdbus-cpp + sdbus-cpp_2 systemd wayland wayland-protocols diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/nix/overlays.nix new/xdg-desktop-portal-hyprland-1.3.9/nix/overlays.nix --- old/xdg-desktop-portal-hyprland-1.3.8/nix/overlays.nix 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/nix/overlays.nix 2024-12-19 01:48:58.000000000 +0100 @@ -5,9 +5,6 @@ }: let ver = lib.removeSuffix "\n" (builtins.readFile ../VERSION); - mkJoinedOverlays = overlays: final: prev: - lib.foldl' (attrs: overlay: attrs // (overlay final prev)) {} overlays; - mkDate = longDate: (lib.concatStringsSep "-" [ (builtins.substring 0 4 longDate) (builtins.substring 4 2 longDate) @@ -16,34 +13,65 @@ version = ver + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); in { - default = mkJoinedOverlays (with self.overlays; [ - xdg-desktop-portal-hyprland - inputs.hyprlang.overlays.default + # List dependencies in ascending order with respect to usage (`foldr`). + default = lib.composeManyExtensions [ + self.overlays.xdg-desktop-portal-hyprland + self.overlays.sdbus-cpp_2 + self.overlays.hypr-gcc14Stdenv inputs.hyprland-protocols.overlays.default - inputs.hyprutils.overlays.default inputs.hyprwayland-scanner.overlays.default - self.overlays.sdbuscpp - ]); + inputs.hyprlang.overlays.default + inputs.hyprutils.overlays.default + ]; + xdg-desktop-portal-hyprland = lib.composeManyExtensions [ (final: prev: { xdg-desktop-portal-hyprland = final.callPackage ./default.nix { - stdenv = prev.gcc13Stdenv; + stdenv = prev.gcc14Stdenv; inherit (final.qt6) qtbase qttools wrapQtAppsHook qtwayland; inherit version; }; }) ]; - sdbuscpp = final: prev: { - sdbus-cpp = prev.sdbus-cpp.overrideAttrs (self: super: { - version = "2.0.0"; + # If `prev` already contains `sdbus-cpp_2`, do not modify the package set. + # If the previous fixpoint does not contain the attribute, + # create a new package attribute, `sdbus-cpp_2` by overriding `sdbus-cpp` + # from `final` with the new version of `src`. + # + # This matches the naming/versioning scheme used in `nixos-unstable` as of writing (10-27-2024). + # + # This overlay can be applied to either a stable release of Nixpkgs, or any of the unstable branches. + # If you're using an unstable branch (or a release one) which already has `sdbus-cpp_2`, + # this overlay is effectively a wrapper of an identity function. + # + # TODO: Remove this overlay after the next stable Nixpkgs release. + sdbus-cpp_2 = final: prev: { + sdbus-cpp_2 = + prev.sdbus-cpp_2 + or (final.sdbus-cpp.overrideAttrs (self: _: { + version = "2.0.0"; + + src = final.fetchFromGitHub { + owner = "Kistler-group"; + repo = "sdbus-cpp"; + rev = "v${self.version}"; + hash = "sha256-W8V5FRhV3jtERMFrZ4gf30OpIQLYoj2yYGpnYOmH2+g="; + }; + })); + }; + # TODO: remove this when the next version of Hyprland is available (in Nixpkgs) + hypr-gcc14Stdenv = final: prev: { + hyprcursor = (prev.hyprcursor.override {stdenv = prev.gcc14Stdenv;}).overrideAttrs (self: super: { src = final.fetchFromGitHub { - owner = "Kistler-group"; - repo = "sdbus-cpp"; - rev = "refs/tags/v${self.version}"; - hash = "sha256-W8V5FRhV3jtERMFrZ4gf30OpIQLYoj2yYGpnYOmH2+g="; + owner = "hyprwm"; + repo = "hyprcursor"; + rev = "f388aacd22be4a6e4d634fbaf6f75eb0713d239a"; + hash = "sha256-+2bZJL2u5hva7rSp65OfKJBK+k03T6GB/NCvpoS1OOo="; }; }); + hyprlang = prev.hyprlang.override {stdenv = prev.gcc14Stdenv;}; + hyprutil = prev.hyprutil.override {stdenv = prev.gcc14Stdenv;}; }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/protocols/meson.build new/xdg-desktop-portal-hyprland-1.3.9/protocols/meson.build --- old/xdg-desktop-portal-hyprland-1.3.8/protocols/meson.build 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/protocols/meson.build 2024-12-19 01:48:58.000000000 +0100 @@ -22,7 +22,7 @@ 'wlr-foreign-toplevel-management-unstable-v1.xml', hl_protocol_dir / 'protocols/hyprland-toplevel-export-v1.xml', hl_protocol_dir / 'protocols/hyprland-global-shortcuts-v1.xml', - wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml', + wl_protocol_dir / 'stable/linux-dmabuf/linux-dmabuf-v1.xml', ] wl_proto_files = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/src/core/PortalManager.cpp new/xdg-desktop-portal-hyprland-1.3.9/src/core/PortalManager.cpp --- old/xdg-desktop-portal-hyprland-1.3.8/src/core/PortalManager.cpp 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/src/core/PortalManager.cpp 2024-12-19 01:48:58.000000000 +0100 @@ -43,6 +43,7 @@ m_sConfig.config->addConfigValue("general:toplevel_dynamic_bind", Hyprlang::INT{0L}); m_sConfig.config->addConfigValue("screencopy:max_fps", Hyprlang::INT{120L}); m_sConfig.config->addConfigValue("screencopy:allow_token_by_default", Hyprlang::INT{0L}); + m_sConfig.config->addConfigValue("screencopy:custom_picker_binary", Hyprlang::STRING{""}); m_sConfig.config->commence(); m_sConfig.config->parse(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/src/core/PortalManager.hpp new/xdg-desktop-portal-hyprland-1.3.9/src/core/PortalManager.hpp --- old/xdg-desktop-portal-hyprland-1.3.8/src/core/PortalManager.hpp 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/src/core/PortalManager.hpp 2024-12-19 01:48:58.000000000 +0100 @@ -15,7 +15,7 @@ #include "hyprland-toplevel-export-v1.hpp" #include "hyprland-global-shortcuts-v1.hpp" -#include "linux-dmabuf-unstable-v1.hpp" +#include "linux-dmabuf-v1.hpp" #include "wlr-foreign-toplevel-management-unstable-v1.hpp" #include "wlr-screencopy-unstable-v1.hpp" @@ -122,4 +122,4 @@ std::mutex m_mEventLock; }; -inline std::unique_ptr<CPortalManager> g_pPortalManager; \ No newline at end of file +inline std::unique_ptr<CPortalManager> g_pPortalManager; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/src/helpers/MiscFunctions.cpp new/xdg-desktop-portal-hyprland-1.3.9/src/helpers/MiscFunctions.cpp --- old/xdg-desktop-portal-hyprland-1.3.8/src/helpers/MiscFunctions.cpp 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/src/helpers/MiscFunctions.cpp 2024-12-19 01:48:58.000000000 +0100 @@ -8,20 +8,17 @@ #include <string> #include <algorithm> +#include <hyprutils/os/Process.hpp> +using namespace Hyprutils::OS; + std::string execAndGet(const char* cmd) { - Debug::log(LOG, "execAndGet: {}", cmd); + std::string command = cmd + std::string{" 2>&1"}; + CProcess proc("/bin/sh", {"-c", cmd}); + + if (!proc.runSync()) + return "error"; - std::array<char, 128> buffer; - std::string result; - const std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose); - if (!pipe) { - Debug::log(ERR, "execAndGet: failed in pipe"); - return ""; - } - while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { - result += buffer.data(); - } - return result; + return proc.stdOut(); } void addHyprlandNotification(const std::string& icon, float timeMs, const std::string& color, const std::string& message) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/src/portals/Screencopy.cpp new/xdg-desktop-portal-hyprland-1.3.9/src/portals/Screencopy.cpp --- old/xdg-desktop-portal-hyprland-1.3.8/src/portals/Screencopy.cpp 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/src/portals/Screencopy.cpp 2024-12-19 01:48:58.000000000 +0100 @@ -5,7 +5,7 @@ #include <libdrm/drm_fourcc.h> #include <pipewire/pipewire.h> -#include "linux-dmabuf-unstable-v1.hpp" +#include "linux-dmabuf-v1.hpp" #include <unistd.h> constexpr static int MAX_RETRIES = 10; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xdg-desktop-portal-hyprland-1.3.8/src/shared/ScreencopyShared.cpp new/xdg-desktop-portal-hyprland-1.3.9/src/shared/ScreencopyShared.cpp --- old/xdg-desktop-portal-hyprland-1.3.8/src/shared/ScreencopyShared.cpp 2024-10-27 19:31:11.000000000 +0100 +++ new/xdg-desktop-portal-hyprland-1.3.9/src/shared/ScreencopyShared.cpp 2024-12-19 01:48:58.000000000 +0100 @@ -9,10 +9,15 @@ #include <sys/stat.h> #include <fcntl.h> +#include <hyprutils/os/Process.hpp> +using namespace Hyprutils::OS; + std::string sanitizeNameForWindowList(const std::string& name) { std::string result = name; std::replace(result.begin(), result.end(), '\'', ' '); std::replace(result.begin(), result.end(), '\"', ' '); + std::replace(result.begin(), result.end(), '$', ' '); + std::replace(result.begin(), result.end(), '`', ' '); for (size_t i = 1; i < result.size(); ++i) { if (result[i - 1] == '>' && result[i] == ']') result[i] = ' '; @@ -42,20 +47,30 @@ static auto* const* PALLOWTOKENBYDEFAULT = (Hyprlang::INT* const*)g_pPortalManager->m_sConfig.config->getConfigValuePtr("screencopy:allow_token_by_default")->getDataStaticPtr(); + static auto* const* PCUSTOMPICKER = (Hyprlang::STRING* const)g_pPortalManager->m_sConfig.config->getConfigValuePtr("screencopy:custom_picker_binary")->getDataStaticPtr(); + + std::vector<std::string> args; + if (**PALLOWTOKENBYDEFAULT) + args.emplace_back("--allow-token"); + + CProcess proc(std::string{*PCUSTOMPICKER}.empty() ? "hyprland-share-picker" : *PCUSTOMPICKER, args); + proc.addEnv("WAYLAND_DISPLAY", WAYLAND_DISPLAY ? WAYLAND_DISPLAY : ""); + proc.addEnv("QT_QPA_PLATFORM", "wayland"); + proc.addEnv("XCURSOR_SIZE", XCURSOR_SIZE ? XCURSOR_SIZE : "24"); + proc.addEnv("HYPRLAND_INSTANCE_SIGNATURE", HYPRLAND_INSTANCE_SIGNATURE ? HYPRLAND_INSTANCE_SIGNATURE : "0"); + proc.addEnv("XDPH_WINDOW_SHARING_LIST", buildWindowList()); // buildWindowList will sanitize any shell stuff in case the picker (qt) does something funky? It shouldn't. - // DANGEROUS: we are sending a list of app IDs and titles via env. Make sure it's in 'singlequotes' to avoid something like $(rm -rf /) - // TODO: this is dumb, use a pipe or something. - std::string cmd = - std::format("WAYLAND_DISPLAY='{}' QT_QPA_PLATFORM='wayland' XCURSOR_SIZE='{}' HYPRLAND_INSTANCE_SIGNATURE='{}' XDPH_WINDOW_SHARING_LIST='{}' hyprland-share-picker{} 2>&1", - WAYLAND_DISPLAY ? WAYLAND_DISPLAY : "", XCURSOR_SIZE ? XCURSOR_SIZE : "24", HYPRLAND_INSTANCE_SIGNATURE ? HYPRLAND_INSTANCE_SIGNATURE : "0", buildWindowList(), - (**PALLOWTOKENBYDEFAULT ? " --allow-token" : "")); + if (!proc.runSync()) + return data; - const auto RETVAL = execAndGet(cmd.c_str()); + const auto RETVAL = proc.stdOut(); + const auto RETVALERR = proc.stdErr(); if (!RETVAL.contains("[SELECTION]")) { // failed + constexpr const char* QPA_ERR = "qt.qpa.plugin: Could not find the Qt platform plugin"; - if (RETVAL.contains("qt.qpa.plugin: Could not find the Qt platform plugin")) { + if (RETVAL.contains(QPA_ERR) || RETVALERR.contains(QPA_ERR)) { // prompt the user to install qt5-wayland and qt6-wayland addHyprlandNotification("3", 7000, "0", "[xdph] Could not open the picker: qt5-wayland or qt6-wayland doesn't seem to be installed."); } @@ -71,11 +86,10 @@ const auto SEL = SELECTION.substr(SELECTION.find_first_of('/') + 1); for (auto& flag : FLAGS) { - if (flag == 'r') { + if (flag == 'r') data.allowToken = true; - } else { + else Debug::log(LOG, "[screencopy] unknown flag from share-picker: {}", flag); - } } if (SEL.find("screen:") == 0) {