Bug 506237

Summary: Make it possible to select screen(s) to share in xdg-desktop-portal from command line
Product: [Plasma] xdg-desktop-portal-kde Reporter: Piotr Dobrogost <bugs.kde.org>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: aleixpol, kde, kde, kdedev
Priority: NOR    
Version First Reported In: 6.4.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
URL: https://discuss.kde.org/t/is-there-a-way-to-select-screen-s-to-share-in-xdg-desktop-portal-from-command-line/36195?u=piotr_dobrogost
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Piotr Dobrogost 2025-06-26 20:11:10 UTC
Make it possible to select screen(s) to share in xdg-desktop-portal from command line and save selection so that there would be no need for physical presence at the remote host to establish connection.

See https://discuss.kde.org/t/is-there-a-way-to-select-screen-s-to-share-in-xdg-desktop-portal-from-command-line/36195?u=piotr_dobrogost
Comment 1 TraceyC 2025-06-30 20:52:03 UTC
.
Comment 2 David Redondo 2025-07-01 12:09:19 UTC
Tricky: 

- we would need to  craft restoredata beforehand as xdg-desktop-portal also needs a matching restore token that the app can use
- that needs app cooperation anyway since it needs to know the token

- we could have an override that skips the dialog for a specific app and selects something chosen beforehand

- interfacing on the command line is tricky since the backend doesnt know where you are typing atm
- there could be a mode where instead of dialogs it wants input on stdin, complicated by the fact that we could by started by dbus activation

- maybe a tool that can list/accept/deny requests???
Comment 3 David Edmundson 2025-07-21 13:00:51 UTC
>and save selection so that there would be no need for physical presence at the remote host to establish connection.

This end goal here makes sense, and is something we are working towards. 
The suggestion here on how to approach it is not the right method and as such I'm closing this.

We want command line options on krdp to say what screen to use and then forward that information to the portal which will then do the thing the client asked. There's no need to have a way to override the portal. 

In the meantime what you're probably looking for is "krdpserver --plasma --virtual-monitor". 

After https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/420 you won't need the "--plasma" part.
Comment 4 David Edmundson 2025-07-21 13:10:12 UTC
Edit, I see you were using rustdesk. But the principle applies.

We also have a semi-hidden method to pre-approve authentication prompts. See 2d4a4dfec07e478ab57fb70a1f531ba496382467 in xdg-dekstop-portal-kde.