Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-12-18 06:19:29

chang-zhao
Member
Registered: 2023-11-20
Posts: 35

That inconvenient FileChooser

One of the most cringeworthy things in XFCE is saving files.

Saving something from Firefox, Audacity, Engrampa etc., I get a very inconvenient Gtk FileChooser window:

(1) When I select a folder from the location drop-down menu, it deletes the file name.

(2) When I click a path component above the currently selected folder, i.e. its parent folder, yes it goes to the parent folder, but the previously visited subfolder remains highlighted, so trying to "Save" I end up in that subfolder again. (And there is no way to un-highlight the subfolder; clicking blank areas doesn't help).

(3) When I want to filter files/folders in the selected folder, I click the file list area, and some file (probably just first one) gets selected (highlighted) in there, deleting (replacing) the original file name.

(4) And if I want to clear the filter, e.g. by clicking "clear entry" icon (or by pressing Backspaces), it doesn't go back to the "clean unfiltered" state. Either I have empty useless space (1) or file names that are still filtered (2):

HJsGAYT.png

(5) Often I can't get the location entry (e.g. when clicking "Extract" in Engrampa), there's only a sequence of path parts, so I can't just paste the desired path, I have to go through a long tedious navigation across folders.

I know all that ugliness is rather a GTK problem than XFCE, and there are already discussions about File Chooser, e.g. to replace it with Thunar dialog or something, which would be nice:

https://forum.xfce.org/viewtopic.php?id=14747

But still, is there yet any practical solution on how to improve this annoying situation, something that I can do today?

I'd really like to have more convenient UI, even if I had to write a few lines in Python or shell script.

Last edited by chang-zhao (2023-12-18 06:38:31)

Offline

#2 2023-12-18 12:02:44

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,032

Re: That inconvenient FileChooser

Short of hacking Gtk and the GtkFileChooser dialog, I don't think you will be able to address any of your concerns directly. There does exist a hacked version of GTK3 called gtk3-classic that has some filechooser improvements (see link for list) that you can use as well.

As a potential alternative approach, there are some discussions about creating an xdg-desktop-portal-xfce interface. From https://wiki.archlinux.org/title/XDG_Desktop_Portal:

Portals were designed for use with applications sandboxed through Flatpak, but any application can use portals to provide uniform access to features independent of desktops and toolkits.

One of the features of using a "foreign" desktop portal, is that you can use another file chooser (for example KDE/Dolphin) in place of GtkFileChooser - not just for flatpack apps, but for all apps. This is done by tricking all apps to believe they are running sandboxed.

Test on Arch:

  1. Install xdg-desktop-portal-kde (note: this will bring in many KDE dependencies

  2. edit the file /usr/share/xdg-desktop-portal/portals/kde.portal and change the last line to read:

    UseIn=KDE;XFCE
  3. To test, close your browser and restart it via:

    GTK_USE_PORTAL=1 firefox

    ...and "Save As" something.

  4. To make it permanent for all apps, add "GTK_USE_PORTAL=1" to one of your start up files (~/.pan_environment, ~/.xprofile, ~/.bashrc - whichever one works for your configuration).

You can follow the discussions and work at the first link above regarding an implementation of thunar as a potential GtkFileChooser replacement.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2023-12-19 10:22:51

chang-zhao
Member
Registered: 2023-11-20
Posts: 35

Re: That inconvenient FileChooser

I try xdg-desktop-portal-kde, but at this step

ToZ wrote:

...
[*]To test, close your browser and restart it via:

GTK_USE_PORTAL=1 firefox

...and "Save As" something.[/*]

saving pages doesn't work. I get:

Gtk-WARNING wrote:

Can't open portal file chooser: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.FileChooser” on object at path /org/freedesktop/portal/desktop

smiley-face-clip-art-thinking-2???

Rebooting doesn't help.

Last edited by chang-zhao (2023-12-19 10:24:18)

Offline

#4 2023-12-19 10:47:44

chang-zhao
Member
Registered: 2023-11-20
Posts: 35

Re: That inconvenient FileChooser

I created '/usr/share/xdg-desktop-portal/portals.conf'

[preferred]
default=gtk
org.freedesktop.impl.portal.FileChooser=kde

and it works.

Offline

#5 2023-12-22 23:32:27

zub
Member
Registered: 2023-01-18
Posts: 30

Re: That inconvenient FileChooser

I have been trying to implement this portal thing but I can't seem to make any difference. Does anyone have a screen shot of the improved  xdg-desktop-portal-kde dialogue? Not sure what I am looking for if it was successful.

I agree with chang-zhao the current dialogue is terrible.

Offline

#6 2023-12-23 00:07:44

zub
Member
Registered: 2023-01-18
Posts: 30

Re: That inconvenient FileChooser

I answer my own question

Screenshot-2023-12-22-185252.png

does look much better!

maybe there would be some way to implement this that was easier to access.for users who do not find the very specific information required to make the change this way. The existing dialogue has other substantial issues not even mentioned in the OP.

I see there are several other backends

    GTK xdg-desktop-portal-gtk
    GNOME xdg-desktop-portal-gnome
    KDE xdg-desktop-portal-kde
    LXQt xdg-desktop-portal-lxqt
    Pantheon (elementary OS) xdg-desktop-portal-pantheon
    wlroots xdg-desktop-portal-wlr
    Deepin xdg-desktop-portal-dde
    Xapp (Cinnamon, MATE, Xfce) xdg-desktop-portal-xapp

https://flatpak.github.io/xdg-desktop-portal/

are they all interchangeable?

Offline

#7 2023-12-25 10:25:46

chang-zhao
Member
Registered: 2023-11-20
Posts: 35

Re: That inconvenient FileChooser

For Firefox it works, and we can even transfer folders' bookmarks between GTK and KDE software:
https://github.com/jlu5/bookmarksync

But unfortunately many programs in XFCE, such as Engrampa Archive Manager, still use native GTK file chooser, so the solution with alternative "portals" doesn't help that much.

zub wrote:

Are they all interchangeable?

Probably (though I don't know what is the difference between xdg-desktop-portal-gtk and xdg-desktop-portal-gnome).

zub wrote:

The existing dialogue has other substantial issues not even mentioned in the OP.

It would be nice to collect all the problems with it and post an issue or something, as a document for discussions and improvements. Or does it already exist?

Offline

#8 2024-01-06 00:33:20

zub
Member
Registered: 2023-01-18
Posts: 30

Re: That inconvenient FileChooser

I did some looking around and I think the appropriate issue tracker might be xfce4-session.

There is currently 1 issue (closed) regarding this that I found: Please provide an xfce-portals.conf for xdg-desktop-portal >= 1.17. It is a bit over my head but I might try to read it later on.

In this 2022 forum post, ToZ said replacing the filechooser would be best suggested at libxfce4ui tracker.  I can't find anything there mentioning the subject so maybe it would be worthwhile if nobody has at least raise the various problems.

I am not sure whether it would be best/plausible-est  to ask for though?
a) fix the various problems in the current file chooser
b) switch to another already-existing option
c) provide better methods for users to switch based on their preferences (e.g. adding some sort of GUI to ToZ's method above)
d) at least documenting the possibility of manual configuration as above
e)  something else?

I would be interested to know what the feelings of the devs are regarding the existing implementation. Do they not find it aggravating to use? I find it causes so much unexpected behavior; I do not know how this is ignored by anyone. Maybe in there is something relevant to be found in the old bugzilla tracker.

Offline

#9 2024-01-07 09:47:53

Tamaranch
Member
Registered: 2020-12-31
Posts: 273

Re: That inconvenient FileChooser

Offline

#10 2024-03-06 21:24:35

chang-zhao
Member
Registered: 2023-11-20
Posts: 35

Re: That inconvenient FileChooser

WARNING
xdg-desktop-portal-kde installs spyware
https://forum.xfce.org/viewtopic.php?id=17327

Offline

Board footer

Powered by FluxBB