7

In almost any program, when I click on open, a file chooser dialog opens as shown below. This dialog shows recently used files Desktop and so on.

file chooser

This is extremely annoying. I would like to see my directory tree instead. I know I can get the directory tree when I click on File System, but I would like to have that selected by default.

I understand this is a gtk2 issue and there are several questions on stack regarding this problem. But I have found no real solution.

I am not asking how to disable the recently used files. I have already done that. The list is empty, but recently used still shows in the file chooser window.

I am using LXDE desktop environment on Debian Wheezy.

UPDATE (2016-SEP-09):

I have created a bounty. I hope somebody can suggest a way how to fix this in source code, so that I can recompile the responsible gtk component/library.

Ideally, in the left pane, I would like to see the filesystem tree starting at /. On the right, I would like to see the subdirectories/files when I click on a directory.

All the labels on the left should be gone (Search, Recently used, home, Desktop, Filesystem). Only the filesystem tree itself should be there.

  • I've been researching this in vain and do not believe it to be possible. – slm Jun 2 '14 at 7:22
1

I don't have gtk2 installed to verify this, but you can try this:

Add StartupMode=cwd to $HOME/.config/gtk-2.0/gtkfilechooser.ini.

I got this from this thread: http://ubuntuforums.org/archive/index.php/t-2160654.html

  • It's not a GTK2 desktop that controls this, the applications that are GTK2 vs. GTK3 will decide on picking up this option or not. That being said all GTK2 apps will then present the file chooser dialog using the current working dir. with cwd set as above. – slm Jun 2 '14 at 1:29
  • @arnefm - the file $HOME/.config/gtk-2.0/gtkfilechooser.ini did not exist. When I create it and add StartupMode=cwd and restart, I see no effect. – Martin Vegter Jun 2 '14 at 7:26
  • @slm: the ini file is automatically picked up by GTK+, this is the relevant code. – ntd Aug 2 '14 at 12:11
  • @Martin Vegter: gtkfilechooser.ini must be already present there (it is saved every time you exit the filechooser dialog). If not you probably have a non standard XDG_CONFIG_HOME, wrong privileges or some sort of other file system problems. – ntd Aug 2 '14 at 12:15
  • 1
    OP wants the file chooser to default to / (not cwd) which is not possible. As per the official gtk2 docs: The StartupMode key controls whether the file chooser starts up showing the list of recently-used files, or the contents of the current working directory. Respectively, the values can be recent or cwd. The same applies to gtk3, you can only choose between recent or cwd (those values are hard-coded). – don_crissti May 6 '15 at 1:41
0

As people already said here, you can set StartupMode=cwd in ~/.config/gtk-2.0/gtkfilechooser.ini. This file exists already, if it is GTK+2, but I am not sure if your screenshot shows GTK+3.

In this case insert this line into your ~/.config/gtk-3.0/settings.ini:

gtk-recent-files-enabled=false

If you want "/" to appear as first view, you need to chdir / before starting the application.

  • neither has any effect. It still looks exactly same as on the screenshot. – Martin Vegter Sep 9 '16 at 17:05
  • I checked on Firefox, Thunderbird and Gimp. It seems to work for me. What application is this? Maybe it's programmed that way that it ignores the system's default behavior. – Martin Sugioarto Sep 9 '16 at 17:40
  • all applications (gpicview, leafpad, .Now I tried Firefox, and that's same as well. – Martin Vegter Sep 9 '16 at 17:45
0

As stated here and elsewhere (e.g., a related post that you already saw Disable "Recently used" in GTK file/directory selector), options are recent or cwd.

It looks like you have to modify the source code.

As per https://git.gnome.org/browse/gtk+/tree/gtk/gtkfilechooserdialog.c, the dialog is created with

g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG,
                     "title", title,
                     "action", action,
                     NULL);

(line 669), so you would have to change g_object_new. See also https://developer.gnome.org/gtk2/stable/GtkFileChooserDialog.html#gtk-file-chooser-dialog-new.

https://developer.gnome.org/gobject/stable/

https://developer.gnome.org/gobject/stable/howto-gobject-construction.html

https://github.com/GNOME/glib/blob/master/gobject/gobject.h

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.