internal: Fix XDP multi-portal issues (#3077)

* add a hyprland portals conf

* remove portal checks

* typo

* Nix: remove portal patch

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
This commit is contained in:
Vaxry 2023-08-26 17:12:21 +02:00 committed by GitHub
parent 299d201e56
commit 4a41d013a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 6 additions and 47 deletions

View file

@ -59,6 +59,7 @@ install:
cd subprojects/wlroots/build/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots && cd ../../../..
cp ./protocols/*-protocol.h ${PREFIX}/include/hyprland/protocols
cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig
cp ./assets/hyprland-portals.conf ${PREFIX}/share/xdg-desktop-portal/
if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi
cleaninstall:

View file

@ -0,0 +1,2 @@
[preferred]
default=hyprland

View file

@ -5,3 +5,5 @@ foreach type : wallpaper_types
install_data(f'wall_@type@@size@K.png', install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime')
endforeach
endforeach
install_data('hyprland-portals.conf', install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal'), install_tag: 'runtime')

View file

@ -100,8 +100,6 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
patches = [
# make meson use the provided wlroots instead of the git submodule
./patches/meson-build.patch
# fixes portals search path to be picked up from $XDG_DESKTOP_PORTAL_DIR
./patches/portals.patch
];
postPatch = ''

View file

@ -1,28 +0,0 @@
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 1d978aed..56665389 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -2365,17 +2365,16 @@ void CCompositor::performUserChecks() {
static auto* const PSUPPRESSPORTAL = &g_pConfigManager->getConfigValuePtr("misc:suppress_portal_warnings")->intValue;
- if (!*PSUPPRESSPORTAL) {
- if (std::ranges::any_of(BAD_PORTALS, [&](const std::string& portal) { return std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/" + portal + ".portal"); })) {
+ static auto* const PORTALDIRENV = getenv("XDG_DESKTOP_PORTAL_DIR");
+
+ static auto const PORTALDIR = PORTALDIRENV != NULL ? std::string(PORTALDIRENV) : "";
+
+ if (!*PSUPPRESSPORTAL && PORTALDIR != "") {
+ if (std::ranges::any_of(BAD_PORTALS, [&](const std::string& portal) { return std::filesystem::exists(PORTALDIR + "/" + portal + ".portal"); })) {
// bad portal detected
g_pHyprNotificationOverlay->addNotification("You have one or more incompatible xdg-desktop-portal impls installed. Please remove incompatible ones to avoid issues.",
CColor(0), 15000, ICON_ERROR);
}
-
- if (std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/hyprland.portal") && std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/wlr.portal")) {
- g_pHyprNotificationOverlay->addNotification("You have xdg-desktop-portal-hyprland and -wlr installed simultaneously. Please uninstall one to avoid issues.", CColor(0),
- 15000, ICON_ERROR);
- }
}
}

View file

@ -2427,22 +2427,7 @@ int CCompositor::getNewSpecialID() {
}
void CCompositor::performUserChecks() {
static constexpr auto BAD_PORTALS = {"kde", "gnome"};
static auto* const PSUPPRESSPORTAL = &g_pConfigManager->getConfigValuePtr("misc:suppress_portal_warnings")->intValue;
if (!*PSUPPRESSPORTAL) {
if (std::ranges::any_of(BAD_PORTALS, [&](const std::string& portal) { return std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/" + portal + ".portal"); })) {
// bad portal detected
g_pHyprNotificationOverlay->addNotification("You have one or more incompatible xdg-desktop-portal impls installed. Please remove incompatible ones to avoid issues.",
CColor(0), 15000, ICON_ERROR);
}
if (std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/hyprland.portal") && std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/wlr.portal")) {
g_pHyprNotificationOverlay->addNotification("You have xdg-desktop-portal-hyprland and -wlr installed simultaneously. Please uninstall one to avoid issues.", CColor(0),
15000, ICON_ERROR);
}
}
// empty
}
void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, CWorkspace* pWorkspace) {

View file

@ -103,7 +103,6 @@ void CConfigManager::setDefaultVars() {
configValues["misc:moveintogroup_lock_check"].intValue = 0;
configValues["misc:hide_cursor_on_touch"].intValue = 1;
configValues["misc:mouse_move_focuses_monitor"].intValue = 1;
configValues["misc:suppress_portal_warnings"].intValue = 0;
configValues["misc:render_ahead_of_time"].intValue = 0;
configValues["misc:render_ahead_safezone"].intValue = 1;
configValues["misc:cursor_zoom_factor"].floatValue = 1.f;