ungoogled-software / ungoogled-chromium-debian

Debian, Ubuntu, and others packaging for ungoogled-chromium
386 stars 49 forks source link

FileChooser always opens on home dir #321

Closed RogueNemo closed 1 year ago

RogueNemo commented 1 year ago

I downloaded the source for debian and successfully followed the directions building the .deb with dpkg, installed the deb and everything works great except for the FileChooser. Every time I open the FileChooser or "Select File Dialog" it defaults to my home directory and never remembers the last directory where I selected a file.

I am running XFCE4, Linux Mint 21.

ghost commented 1 year ago

What version? We haven't even published a new version for Jammy yet.

RogueNemo commented 1 year ago

I think it is latest version, just built it yesterday.

111.0.5563.146

I actually fixed it for myself by modifying my filechooser.c in source code for xdg-desktop-portal-gtk and replaced /usr/libexec/xdg-desktop-portal-gtk with my newly built one.

I read that GTK3 is always obeying gsetting for CWD or Recent-files and they removed the option to set last saved path.

I thought Chromium tried to override this behavior itself, but it is not working for some reason if it is supposed to work.

I just set my gsetting to CWD and added chdir call to xdg-desktop-portal-gtk on file open response.

`

 #include <unistd.h>
 #include <libgen.h>

  g_autoptr(GFile) base_dir = g_file_new_for_uri (handle->uris->data);
  char *absfilename = g_file_get_path(base_dir);
  char *pathname = dirname(absfilename);

  int ret = chdir(pathname);   

  g_free (absfilename);`

But I guess maybe Chromium should be calling the set folder function before opening the dialog with the last folder opened that it saved itself.

RogueNemo commented 1 year ago

Or I guess one was talking about Mint 21 being based on Ubuntu Jammy, which I believe it is, so I guess it is not expected work yet, I will close the issue until at least a Jammy\Bookworm version is released.

RogueNemo commented 1 year ago

Or, oops. never mind I actually think my Mint 21 is based on Hirsute\Bullseye.

ghost commented 1 year ago

No, it's based on Jammy. Hirsute was a regular release that is no longer supported.

RogueNemo commented 1 year ago

Oh yeah, that's right, I just checked /etc/debian_version and it's Bookworm.

ghost commented 1 year ago

I just don't know what the "normal" behavior for Chromium is in this situation given how infrequently the file dialog is usually used with browsers typically. I won't really be investigating this at all until Chromium 112 is implemented.

RogueNemo commented 1 year ago

I use the open file dialog constantly uploading files to social media and other sites sometimes from my Desktop sometimes from a archive folder etc, I like it to remember the last place I picked one, but it seems like on Linux this is a GTK behavior anyway, but they are pretty adamant about removing the setting they used to have to do this.

I saw some last_opened_path() call in ui/gtk/select_file_dialog_linux_gtk.cc for Chromium so I thought maybe Chromium at one time thought it was normalizing this behavior.