Skip to content

InputCapture support for session persistence#214

Open
whot wants to merge 16 commits intoflatpak:mainfrom
whot:wip/inputcapture-persistence
Open

InputCapture support for session persistence#214
whot wants to merge 16 commits intoflatpak:mainfrom
whot:wip/inputcapture-persistence

Conversation

@whot
Copy link
Copy Markdown
Contributor

@whot whot commented Jan 30, 2026

This is on top of @Jahdal's work from #208

See flatpak/xdg-desktop-portal#1898 for references to other components.

@whot
Copy link
Copy Markdown
Contributor Author

whot commented Jan 30, 2026

Note that this is missing a version check, it's not clear yet whether the new features are version 2 or 3 and we'll only need it for the latter case. And even if we don't have it, shoving the options in doesn't hurt so... meh?

edit: merged upstream as version 2 so no version check for 3 is needed

@whot
Copy link
Copy Markdown
Contributor Author

whot commented Mar 13, 2026

xdg-desktop-portal has merged support for this so we should be ready to go

@sithlord48
Copy link
Copy Markdown

@jadahl Is there anything holding this up or can we get this landed?

@KoljaFrahm
Copy link
Copy Markdown

Also according to the reactions, there are a lot of people waiting that this gets landed (+ a release after)
Can this be merged? :)

@whot
Copy link
Copy Markdown
Contributor Author

whot commented Mar 26, 2026

I've had another quick test (hoping it works) but I'm getting valgrind errors, please don't merge this yet.

edit: fix in #217

@KoljaFrahm
Copy link
Copy Markdown

Seems like the fix is merged, thank you!

@sithlord48
Copy link
Copy Markdown

Im looking forward to this if only to stop the almost daily AI generated PR's in deskflow to add this.

@whot whot force-pushed the wip/inputcapture-persistence branch from e2e7402 to ede09b0 Compare March 26, 2026 12:17
@whot
Copy link
Copy Markdown
Contributor Author

whot commented Mar 26, 2026

There's a little tool to test all this a bit easier now: https://github.com/whot/libportal-clipboard-test

And with #217 fixed valgrind is happy now, so this should be good to go.

Comment thread libportal/inputcapture.c

if (call->session->restore_token)
g_variant_builder_add (&options, "{sv}", "restore_token",
g_variant_new_string (call->session->restore_token));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this do a version check on the portal first? The clipboard one doesn't, but it also is just a request method that may fail, so it's harmless to do without checking the version. Here one would have to avoid setting these for older versions since otherwise the request I assume would fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done (as follow-up to make it easier to review), and I added a bunch of test cases too

@sithlord48
Copy link
Copy Markdown

Should the methods names here be considered "final" ?

@jadahl
Copy link
Copy Markdown

jadahl commented Apr 14, 2026

Should the methods names here be considered "final" ?

You mean they can't be renamed? I'd consider them final once the pull request lands and there is a release; before that things not yet added can be renamed.

@sithlord48
Copy link
Copy Markdown

Should the methods names here be considered "final" ?

You mean they can't be renamed? I'd consider them final once the pull request lands and there is a release; before that things not yet added can be renamed.

After this lands is there a plan for release ?

@jadahl
Copy link
Copy Markdown

jadahl commented Apr 14, 2026

After this lands is there a plan for release ?

That be a sensible thing to do at least.

jadahl added 2 commits April 15, 2026 08:42
This will be necessary when handling signals, which needs to fetch the
session from a handle.
This adds API to interact with the clipboard portal associated with a
remote desktop session.
jadahl and others added 14 commits April 15, 2026 08:42
This makes the label not "fly away" when some other widget makes its
column wider.
Only starts the session and reports the shared devices and streams.
This allows copying to, and pasting from, the clipboard portal.
This makes it easier to construct a session from somewhere else, which
will be needed with CreateSession2().
It's its own thing, that also controls the lifetime of the actual
session, so need some special casing.
Rather useless, since we're not adding any barriers, but more complete
none the less.
In API version 2, the CreateSession() was replaced by
CreateSession2()/Start(); add API that corresponds to this.

Unfortunately applications will need to check whether this is supported
by manually checking the exposed API version, to use the new
construction method.
This will allow enabling clipboard integration later.
If the caller hasn't queried the version yet do so before we call into
start_session. This is required for correctly sending the restore_token
option which we may only send if the version is >= 2.
Our existing tests are derived from dbusmock.DBusTestCase which uses
the unittest framework, preventing us from using pytest
parameterization. So duplicate the tests for legacy and new approach
until that architecture is fixed.

And then add a few new tests for session persistence.

Co-Authored-by: Claude Code <noreply@anthropic.com>
@whot whot force-pushed the wip/inputcapture-persistence branch from ede09b0 to e200035 Compare April 15, 2026 03:02
@sithlord48
Copy link
Copy Markdown

LGTM

@KoljaFrahm
Copy link
Copy Markdown

The PR is tested and approved, so can you merge it?
And please do a release after

@skewty
Copy link
Copy Markdown

skewty commented Apr 28, 2026

Tagging @smcv (Simon) who was instrumental in last version release. Are we good to go for another release? If not, what is missing / required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants