You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At least when using Atom with Plasma DE, the file dialog is the GTK File Chooser one, which feels severely out-of-place (though one gets used to it from using other non-DE aware GTK apps). It would be nice if it could use QFileDialog as does Chromium.
Reacted by Jan Molnár, Darrell Ulm, Kolya Ay, Giorgi Gzirishvili, vgveloso, Alexander Huszagh, Nicolas F., Chihell, João Paulo Albuquerque, Oskar and 70 more
Reacted by Hrvoje, Alexander Bantyev, João Paulo Albuquerque, Phraqzy, LCore, Alexey Murz Korepov, Aminda Suomalainen ⚧, Diana, AtomToast, Derek Christ and 7 more
Good thinking! It doesn't actually use any Qt binding, it just invokes the command line utility kdialog. Seems easy enough. It will only work with Plasma, though, and not e.g. for LXQt.
Keeping this as a reminder for myself if you don't mind.
The interesting point is in https://github.com/atom/electron/tree/master/atom/browser/ui. We have to
figure how to make electron use it if the current DE is Plasma
If we want to get fancy about it, figure a way to (possibly as an option) use it or a similar file picker for LXQt/other Qt based DEs (are there any ?). apparently, the other Qt desktops use kdialog, so it would work for them, too.
QFileDialog would be good every Qt based DE hooks their module in the provide their native dialog if needed (look at frameworksintegration). I dont if its possible but using QFileDialog for every plattform would be possible too since it provides integration for every plattform.
Never mind, doing this is above my current knowledge I will first need to learn more about C++ before being able to implement this. If anybody else is picking this up I would be interested in pair programming though.
Using a few electron apps (GitKraken and Atom mostly), along with Chromium. Any updates on getting this supported? Or at least someone knowledgeable about the codebase that'd be happy to work with one of us to add the support?
Seems progress is being made on a related issue, GTK3 support however. I think I've heard of Flatpak packaged apps being able to use Qt file choosers, so that might work as a workaround?
@Thaodan Unfortunately, the overhead for spawning a new process each time you want an open/save dialog gets irritating very quickly. Chrome did it and, as much as I'd like native KDE dialogs, I had to force it back to GTK+ dialogs with export NO_CHROME_KDE_FILE_DIALOG=1 because I just couldn't stand the added sluggishness.
(Though, admittedly, that's partly because I'll middle-click a bunch of image links, then alternate between Ctrl+S and Ctrl+W, which makes any added delays very noticeable.)
Portals would avoid that because calling into the portal host over D-Bus doesn't require spawning a new process each time.
Also, portals would avoid the need to include "When do we use which picker?" logic in Electron when a user has more than one desktop installed and is mixing components. (Just use GtkFileChooserNative and it's the user's problem for not configuring their desktop and GTK the way they want.)
That said, if you do want to play with them, the commands you're looking for are
kdialog --getopenfilename [startDir] [filter]
kdialog --getsavefilename [startDir] [filter]
kdialog --getexistingdirectory [startDir]
kdialog --getopenurl [startDir] [filter]
kdialog --getsaveurl [startDir] [filter]
They all require that you provide at least one argument, but will accept a filter without a startDir. (eg. you can pass *.txt and they'll recognize it as a filter and assume you want to start in the current working directory.
One thing to consider against a separate process file dialog is the inability of window managers to properly display modality in such cases. (for example block the primary window and dim the background)
One thing to consider against a separate process file dialog is the inability of window managers to properly display modality in such cases. (for example block the primary window and dim the background)
It passes the window id to the other process so on x11 it can work.
It passes the window id to the other process so on x11 it can work.
It can work on Wayland too, if the portal host and compositor are written to work together, which makes sense, given that the DE is already supposed to write/customize both components to provide an integrated experience.
As for kdialog, that's done via this...
--attach <winid> Makes the dialog transient for an X app specified by winid
Zenity (GTK+'s equivalent) is confusing in that respect because it has --modal but appears to have no way to specify a parent window to be transient to. (Just the X11 class and name properties, which aren't even specific to a single process, let a lone a single window.)
The PR is feature complete I think, so all that is left to do is figuring out is another serious code review from an electron contributor so we can decide if loading the module and functions as static classs members would be more beneficial.
Reacted by Robert Riemann, Alexandre, Derek Christ and Matthew
The PR might need a rebase, but I tested it and it worked, but I don't work with Electron at all, nor am I a contributor so someone would honestly need to plug in my branch of electron into their project and see if anything breaks.
Reacted by Jan Molnár, Alexey Murz Korepov, Merlijn Sebrechts, Derek Christ and modelmat
@DemiMarie That happens automatically when using GtkFileChooserNative. GTK has built-in support for indirecting through Flatpak portals... it just requires applications to request OS-native file dialogs instead of always using the customizable GTK-provided ones.
(Same thing with Qt for that matter, except that Qt's API was designed around using OS-native dialogs by default, so most Qt applications didn't need to change anything.)
Activity
zcbenz commentedon Sep 27, 2015
Sounds good to me, the Chromium's dialog implementation can be a good start:
https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc.
Evpok commentedon Sep 27, 2015
Good thinking! It doesn't actually use any Qt binding, it just invokes the command line utility
kdialog. Seems easy enough. It will only work with Plasma, though, and not e.g. for LXQt.Evpok commentedon Oct 22, 2015
Keeping this as a reminder for myself if you don't mind.
The interesting point is in
https://github.com/atom/electron/tree/master/atom/browser/ui. We have tohttps://github.com/atom/electron/blob/master/atom/browser/ui/file_dialog_plasma.ccIf we want to get fancy about it, figure a way to (possibly as an option) use it or a similar file picker for LXQt/other Qt based DEs (are there any ?).apparently, the other Qt desktops use kdialog, so it would work for them, too.Siilwyn commentedon Aug 30, 2016
This is still needed right? I'd be interested in picking this up, not sure how to test though since I use Gnome...
Thaodan commentedon Sep 22, 2016
QFileDialog would be good every Qt based DE hooks their module in the provide their native dialog if needed (look at frameworksintegration). I dont if its possible but using QFileDialog for every plattform would be possible too since it provides integration for every plattform.
Siilwyn commentedon Oct 8, 2016
Never mind, doing this is above my current knowledge I will first need to learn more about C++ before being able to implement this. If anybody else is picking this up I would be interested in pair programming though.
polarathene commentedon Apr 7, 2017
Using a few electron apps (GitKraken and Atom mostly), along with Chromium. Any updates on getting this supported? Or at least someone knowledgeable about the codebase that'd be happy to work with one of us to add the support?
Seems progress is being made on a related issue, GTK3 support however. I think I've heard of Flatpak packaged apps being able to use Qt file choosers, so that might work as a workaround?
jhasse commentedon Apr 28, 2017
I would even say that should be the way forward.
Gim6626 commentedon Jul 10, 2017
I think this feature is important too. Is there any progress on the issue?
codebytere commentedon Jul 29, 2017
Hey all: a fix for this is in the works, and in the meantime here's a module to provide a workaround until it's been completed
Thaodan commentedon Jul 29, 2017
22 remaining items
ssokolow commentedon Feb 8, 2019
@Thaodan Unfortunately, the overhead for spawning a new process each time you want an open/save dialog gets irritating very quickly. Chrome did it and, as much as I'd like native KDE dialogs, I had to force it back to GTK+ dialogs with
export NO_CHROME_KDE_FILE_DIALOG=1because I just couldn't stand the added sluggishness.(Though, admittedly, that's partly because I'll middle-click a bunch of image links, then alternate between Ctrl+S and Ctrl+W, which makes any added delays very noticeable.)
Portals would avoid that because calling into the portal host over D-Bus doesn't require spawning a new process each time.
Also, portals would avoid the need to include "When do we use which picker?" logic in Electron when a user has more than one desktop installed and is mixing components. (Just use
GtkFileChooserNativeand it's the user's problem for not configuring their desktop and GTK the way they want.)That said, if you do want to play with them, the commands you're looking for are
kdialog --getopenfilename [startDir] [filter]kdialog --getsavefilename [startDir] [filter]kdialog --getexistingdirectory [startDir]kdialog --getopenurl [startDir] [filter]kdialog --getsaveurl [startDir] [filter]They all require that you provide at least one argument, but will accept a filter without a startDir. (eg. you can pass
*.txtand they'll recognize it as a filter and assume you want to start in the current working directory.Rush commentedon Feb 9, 2019
One thing to consider against a separate process file dialog is the inability of window managers to properly display modality in such cases. (for example block the primary window and dim the background)
TingPing commentedon Feb 9, 2019
It passes the window id to the other process so on x11 it can work.
ssokolow commentedon Feb 9, 2019
It can work on Wayland too, if the portal host and compositor are written to work together, which makes sense, given that the DE is already supposed to write/customize both components to provide an integrated experience.
As for kdialog, that's done via this...
Zenity (GTK+'s equivalent) is confusing in that respect because it has
--modalbut appears to have no way to specify a parent window to be transient to. (Just the X11 class and name properties, which aren't even specific to a single process, let a lone a single window.)tristan957 commentedon Jul 8, 2019
I will be taking a second crack at creating a PR for this issue since the last on never got merged.
madprops commentedon Aug 14, 2019
Please support QT and KDE.
TingPing commentedon Aug 14, 2019
@madprops The proposed solution supports Qt dialogs. (Perhaps read the discussion before uselessly bumping it)
MurzNN commentedon Dec 17, 2019
Here https://github.com/codebytere/native-kde-file-open is workaround to open native KDE file open dialogs in current Electron.
tristan957 commentedon Mar 8, 2020
The PR is feature complete I think, so all that is left to do is figuring out is another serious code review from an electron contributor so we can decide if loading the module and functions as static classs members would be more beneficial.
ShalokShalom commentedon May 7, 2020
Is there anything left to do, besides the code review?
tristan957 commentedon May 7, 2020
The PR might need a rebase, but I tested it and it worked, but I don't work with Electron at all, nor am I a contributor so someone would honestly need to plug in my branch of electron into their project and see if anything breaks.
DemiMarie commentedon Dec 20, 2020
Can this be extended to handle Flatpak’s portal? Right now the file picker is simply not compatible with the sandbox.
tristan957 commentedon Dec 20, 2020
The pr takes care of Flatpaks as well
ssokolow commentedon Dec 20, 2020
@DemiMarie That happens automatically when using
GtkFileChooserNative. GTK has built-in support for indirecting through Flatpak portals... it just requires applications to request OS-native file dialogs instead of always using the customizable GTK-provided ones.(Same thing with Qt for that matter, except that Qt's API was designed around using OS-native dialogs by default, so most Qt applications didn't need to change anything.)