-
Notifications
You must be signed in to change notification settings - Fork 28.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linux: use GTK_USE_PORTAL=1 to support the XDG Desktop Portal #126113
Conversation
@tristan957 I have built the vscodium (also tried vscodium-git from aur) with your patch. And it did not work. Then I have found out how to check electron version of app (from here). Surprisingly, it was 13.5.1. But I only have the Now the question is, is it possible to switch it to use system's version of electron? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM following Electron 16 update to main
branch.
Oh I did submit this PR... Still wonder how necessary it is, but it probably wouldn't hurt. |
yeah considering this more of a good thing to have with no negative side effects, I am fine with the change. Thanks for the PR! |
Should we set GTK_USE_PORTAL=1 unconditionally? Edit: Oh wait...now I get it. Yea this is fine :). Didn't even remember the code Is using |
Yeah you are right, can you update the PR. Thanks! Btw, this code path will get executed only user launches the application from the cli, if they are triggered from launchers then we might need to set it up in https://github.com/microsoft/vscode/blob/main/resources/linux/code.desktop |
I think that should do it? |
Electron 14 will have support for file managers through the XDG Desktop Portal Specification. In order to explicitly opt into support assuming a user has an xdg-desktop-portal-* package installed, GTK needs to be told to use it. This will allow for alternative file managers on KDE or wlroots-based systems.
I don't have a good way to verify this on my machine, would you be willing to verify the fix if I were to make a custom build from this branch ? Thanks! |
I could give it a go. Need to break out my dbus-foo |
I just tried this on code-insiders build on electron 16. It didn't work. |
What didn't work? |
Sorry, using the gtk protal env var didn't allow vscode to use the plasma filepicker when I tried it. I have since switched back to gnome so it no longer affects me, but I wonder if anyone else has gotten it working? |
@Moonlight63 are you using a version of VSCode with electron >= v14 and do you have xdg-desktop-portal-kde installed? |
Yes, I did. I had vs code insiders and other applications like Firefox did respect the portal, but vs code still ignored it. Like I said, I just switched back to gnome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GTK_USE_PORTAL
was a debug flag and shouldn't be used. It has been moved to a flag in GDK_DEBUG
for clarity.
Here is a small recap
Thanks to @tristan957 (thanks!) work in electron/electron#19159, Electron already use the native Linux file picker if it's running in a sandboxed env (Snap / Flatpak).
IIRC in order for Electron to always use the native file picker, even when not running sandboxed, Electron needs to swap GtkFileChooserNative for the new GtkFileDialog.
However, GtkFileDialog
is only available in Gtk 4.10 . I don't know what Electron policy is regarding dependencies.
Should I file an issue on the Electron repository, and we can pick it up there?
I suggest closing this PR as it won't do anything.
Thanks for summarizing @sonnyp. Agree with closing this PR, as for gtk4 support it is currently tracked under electron/electron#33690 Additionally we would want to refactor the file dialog impl in Electron to reuse Chromium's impl, ref electron/electron#35110 (comment). I am looking into that as part of #146422 |
Electron 14 will have support for file managers through the XDG Desktop
Portal Specification. In order to explicitly opt into support assuming
a user has an xdg-desktop-portal-* package installed, GTK needs to be
told to use it. This will allow for alternative file managers on KDE or
wlroots-based systems.
This PR fixes #50386 amongst others, once VSCode adopts Electron v14.