KRFB on Wayland, Have to confirm "Remote control requested"

Hi, I have just read the source code and written a patch for this purpose. Apply the patch to xdg-desktop-portal-kde, and the “Remote control requested” window will not appear, krfb will be granted automatically.

diff --git a/src/remotedesktop.cpp b/src/remotedesktop.cpp
index 9c27b10..100d6f3 100644
--- a/src/remotedesktop.cpp
+++ b/src/remotedesktop.cpp
@@ -136,10 +136,6 @@ uint RemoteDesktopPortal::Start(const QDBusObjectPath &handle,
         Utils::setParentWindow(remoteDesktopDialog->windowHandle(), parent_window);
         Request::makeClosableDialogRequest(handle, remoteDesktopDialog.get());
         connect(session, &Session::closed, remoteDesktopDialog.data(), &RemoteDesktopDialog::reject);
-
-        if (!remoteDesktopDialog->exec()) {
-            return 1;
-        }
     }
 
     if (session->screenSharingEnabled()) {

I tested on 5.27.10.

If you are using NixOS, here is an expression to apply this patch:

    nixpkgs.overlays = [(final: prev:
    {
      libsForQt5 = prev.libsForQt5.overrideScope (final: prev:
      {
        plasma5 = prev.plasma5.overrideScope (final: prev:
        {
          xdg-desktop-portal-kde = prev.xdg-desktop-portal-kde.overrideAttrs (prev:
            { patches = (prev.patches or []) ++ [ ./krfb.patch ]; });
        });
        xdg-desktop-portal-kde = final.plasma5.xdg-desktop-portal-kde;
      });
    })];
3 Likes