Skip to content

feat: handle input capture session persistence#9415

Draft
whot wants to merge 1 commit intodeskflow:masterfrom
whot:wip/inputcapture-persistence
Draft

feat: handle input capture session persistence#9415
whot wants to merge 1 commit intodeskflow:masterfrom
whot:wip/inputcapture-persistence

Conversation

@whot
Copy link
Copy Markdown
Contributor

@whot whot commented Feb 2, 2026

Description

Use the new libportal API to start a CreateSession2, then set the session persistence and read/write the tokens as required. This allows us to start a server without a permission dialog - provided the portal supports it and the user is ok with that.

See flatpak/xdg-desktop-portal#1898 for a list of components/branches/mrs that are required to get this working, you will need libportal, xdg-desktop-portal-gnome and xdg-desktop-portal.

Disclosure of AI use

Google Gemini was asked for how to read/write a string to a file with Qt, see the helper functions.

Related Issue

#8032
fixes: #9599

How Has This Been Tested?

This assumes a Fedora 43 box, adjust as required

> toolbox create deskflow
> toolbox enter deskflow
... you are now in the toolbox container
toolbox> sudo dnf builddep deskflow
toolbox> sudo dnf builddep -y xdg-desktop-portal xdg-desktop-portal-gnome libportal

toolbox> cd xdg-desktop-portal
toolbox> meson setup build -Dprefix=/usr
toolbox> meson compile -C build

... repeat for libportal/xdg-desktop-portal-gnome

toolbox> cd deskflow
... setup and build


toolbox> flatpak-spawn --host ./build/src/xdg-desktop-portal-gnome --replace &
toolbox> flatpak-spawn --host ./build/src/xdg-desktop-portal --replace &
toolbox> ./build/bin/deskflow

The updated dialog has a checkbox for rememberin the permission which gets stored in XDG_STATE_HOME/deskflow/restore-token.txt and next time that token will be re-used (if allowed) and deskflow-server no longer requires the user interaction.

This is a Draft PR. I won't have time to finish it and polish it but all the pieces are there so it can be picked up and integrated correctly (esp. the token read/write). So any volunteers, please take this!

It's backwards-compatible to the current portals (I hope, haven't tested :)

Edit, Sithlord48

  • Added a check for the new functions in libportal should build now with any version of libportal
  • Remove the temp helpers and write the token info to Settings::Server::XdpRestoreToken
  • Added to the configuration.md the new setting

Waiting on flatpak/libportal#214 to land

@sithlord48

This comment was marked as outdated.

@whot whot force-pushed the wip/inputcapture-persistence branch from d7f30fb to b824bd8 Compare February 2, 2026 03:03
@whot

This comment was marked as outdated.

@sithlord48

This comment was marked as outdated.

@deskflow deskflow deleted a comment from github-actions bot Feb 2, 2026
@deskflow deskflow deleted a comment from github-actions bot Feb 2, 2026
@sithlord48 sithlord48 added ✨ enhancement A suggested change to improve functionality wayland This issues effects Wayland on Linux labels Feb 2, 2026
@sithlord48 sithlord48 linked an issue Feb 2, 2026 that may be closed by this pull request
@whot

This comment was marked as outdated.

Copy link
Copy Markdown
Member

@nbolton nbolton left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Would you mind changing to camelCase instead of snake_case for the function names and vars? [Of course, does not apply to the lib functions]

@sithlord48 sithlord48 force-pushed the wip/inputcapture-persistence branch from b824bd8 to 36d0554 Compare February 2, 2026 13:07
@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Feb 2, 2026

I pushed some updates here

  • Use a cmake check_symbol_exists to check for the restore ability in libportal's inputcapture support. (guard new code if its not found)
  • Use camelCase vars for the few added.
  • Use the settings to save the restore token similarly to how we do it in the RemoteDesktop portal

@sithlord48 sithlord48 force-pushed the wip/inputcapture-persistence branch from 36d0554 to 8419f3c Compare February 2, 2026 13:42
@deskflow deskflow deleted a comment from github-actions bot Feb 2, 2026
@sithlord48 sithlord48 force-pushed the wip/inputcapture-persistence branch 3 times, most recently from 323fe86 to 78c37b4 Compare February 2, 2026 13:58
@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Feb 2, 2026

@whot this should now be up to our standards. It also no longer breaks the build when libportal does not have the correct methods. If the portal side is not going to change IMHO we could land this as its "safe enough" if that will help you land the other parts faster.

@deskflow deskflow deleted a comment from github-actions bot Feb 2, 2026
@sithlord48 sithlord48 requested a review from nbolton February 2, 2026 15:17
@whot
Copy link
Copy Markdown
Contributor Author

whot commented Feb 2, 2026

Thanks for the fixes, much appreciated. The big ticket item for the portal bits is the clipboard integration which requires more changes on the deskflow side than this. The inputcapture persistence bits are based on those so I recommend not merging until the clipboard is sorted.

Oh, and getting clipboard support via portals into deskflow would go a long way towards validating the portal additions so they can actually be merged. 🐔, 🥚 etc.

@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Feb 3, 2026

Honestly @whot if you can help w/ clipboard here that would be a MASSIVE help . We can add any if checks we need here to align w/ libportal and that way you can test a full stack

Copy link
Copy Markdown
Contributor Author

@whot whot left a comment

Choose a reason for hiding this comment

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

fwiw, to build errors I encountered

@sithlord48 sithlord48 force-pushed the wip/inputcapture-persistence branch from 78c37b4 to a71d481 Compare February 5, 2026 02:47
@sithlord48
Copy link
Copy Markdown
Member

Should both be fixed now. I no longer store the token as a member var

@github-actions

This comment was marked as outdated.

@whot
Copy link
Copy Markdown
Contributor Author

whot commented Feb 6, 2026

Pushed a fixup comment on top for easier review - in my local setup I had CreateSession2 fail, crashing deskflow which could be construed as bad UX.

@whot whot mentioned this pull request Feb 6, 2026
3 tasks
@sithlord48
Copy link
Copy Markdown
Member

Note: We don't "Squash" land or anything so when this is ready for review some one has to fix up that fixup.

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Feb 6, 2026

Will try to test as well as #9431 while I'm building all those libs.

Note: We don't "Squash" land or anything so when this is ready for review some one has to fix up that fixup.

Yeah we can worry about getting the commits perfect when it's time to land.

@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Feb 6, 2026

Edit: wrong pr the comment was intended for #9431

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Feb 6, 2026

my libportal is too old

You'll need to build and install it.

On GNOME, I'm also having to build latest:

  • xdg-desktop-portal-gnome
  • gsettings-desktop-schemas

Let me know if it's easier on KDE and I might test on my Arch laptop as Wayland server.

@sithlord48
Copy link
Copy Markdown
Member

On kde the portal backend has a pr somewhere I think.. ( this will likey be used to test it on the kde side also )

@sithlord48 sithlord48 force-pushed the wip/inputcapture-persistence branch from cf38696 to e45f9bc Compare February 7, 2026 05:01
@sithlord48
Copy link
Copy Markdown
Member

Updated and squashed the 'fixup' commit into the first one.

@sithlord48
Copy link
Copy Markdown
Member

@whot any idea if libportal-next will contain both this and the clipboard or only the clipboard ? trying to figure out if i this should be rebased on the changes needed for the clipboard or not.

@whot
Copy link
Copy Markdown
Contributor Author

whot commented Feb 23, 2026

it'll all depend on when flatpak/xdg-desktop-portal#1898 gets pulled. Once that one is in, libportal will follow likely immediately

@sithlord48 sithlord48 force-pushed the wip/inputcapture-persistence branch 2 times, most recently from a22433a to 2548967 Compare February 25, 2026 03:40
@sithlord48
Copy link
Copy Markdown
Member

@whot can you ping me when the methods used here are not going to change so we can land this part.

Use the new libportal API to start a CreateSession2, then set the
session persistence and read/write the tokens as required. This allows
us to start a server without a permission dialog - provided the portal
supports it and the user is ok with that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ enhancement A suggested change to improve functionality wayland This issues effects Wayland on Linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist Input Capture Abilty Persist Input Capture XDG Desktop Portal dialog (Wayland)

3 participants