In Ubuntu and Kubuntu 11.10 I see changes in behaviour of GTK file chooser dialog. When I try to open new file (second, third etc, not first in editor) dialog show "Recenty used" section. It is very unsuitable for me, in 10.04 dialog shows folder where located previous open file. Anybody knows how i can bring back old behaviour?
7 Answers
To my knowledge, this is a "feature" of GTK+ 3.x, and I'm not so certain it can be changed.
If I find a solution I will update my answer, but for now I don't know of any (other than reporting a bug).
Update:
I believe I may have found a partial solution. It's not a permanent one unfortunately.
- Install
dconf-tools. - Run
dconf-editor. - Navigate to
org.gtk.settings.file-chooser. - Change the
last-folder-urivalue to the folder of your choosing, for examplefile:///home/rolandixor/Desktop. - Your file chooser dialogues should now use this folder by default. However, they will revert to recently used if you use the dialogue but do not actually open/save a file.
Update2:
As this is rather tricky, here is another possible solution (partial):
- Open
gedit. - Open a file (from the folder you want to use).
- Save a file (save as) to the folder you want to use.
- Close gedit. This will only work if you actually open a file from a folder and save to a folder. If you open the dialogue and don't do anything, it will revert when you close it. There is no way around this.
- 51,797
For GTK2 you want to edit $XDG_CONFIG_HOME/gtk-2.0/gtkfilechooser.ini and set
StartupMode=cwd
For GTK3 there is no way to change it. In older versions this command might work
gsettings set org.gtk.Settings.FileChooser startup-mode cwd
- 44,904
- 8
- 102
- 162
- 151
- 1
- 3
I was also bugged by this behaviour and gave it a closer look during the last days.
I have found only one of the GTK3 applications so far that always brings up Recently Used at fresh start: Gedit. All other apps I have tested (Totem, Eog, Evince, File-Roller, ...) start with a "normal" folder in their file chooser (tested with fresh guest session).
So I did a small patch that makes Gedit fall back on the Home folder instead of Recently Used: http://pastebin.com/GhXCRzNV
I can also provide a debdiff if requested, or create a PPA.
- 89
Maybe it would be easier to patch gtk3 to populate the recently used files with the folder the last file was in as well. I think that would work nicely for me.
- 263
last-folder-uri will get changed the next time you use the file chooser, instead you need to set startup-mode:
Install dconf-editor via Software center:
or via cli
sudo dnf install dconf-editor
Launch it, then navigate to org.gtk.settings.file-chooser.startup-mode
It doesn't seem possible to access this key from dconf cli, instead you can look at gsettings:
gsettings set org.gtk.gtk4.Settings.FileChooser startup-mode 'cwd'
If you're getting an error that gsettings is using the memory backend, then you probably need to check which gsettings executable you're using:
which gsettings
# MYHOME/.asdf/shims/gsettings
(in my case, I'd forgotten that I'd installed anaconda python with asdf which brings in a whole lot of unnecessary shims)
asdf uninstall python anaconda-2018.12
- 296
For those looking for an answer to that question in more recent times than the original poster, this worked for me on Ubuntu 22.04:
gsettings set org.gtk.Settings.FileChooser startup-mode 'cwd'
gsettings set org.gtk.gtk4.Settings.FileChooser startup-mode 'cwd'
- 141
Also you could use shortcut for revealing Location input box and going to desired directory: ~ (tilde sign), Shift-` on some keyboards.
- 1,107


