LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   XFCE4, Wheezy, Open Dialog (https://www.linuxquestions.org/questions/debian-26/xfce4-wheezy-open-dialog-4175460570/)

radiodee1 05-03-2013 08:21 AM

XFCE4, Wheezy, Open Dialog
 
I use debian wheezy and xfce4. I want to make it so that whenever I open a file from inside some editor (gedit for example) I'm presented with my home folder in the 'Open' dialog. Currently when I try to open a file and sometimes even when I'm saving a file, I get a dialog that shows me 'Recently Used'. I find this a waste of time since I usually save new files in the home directory and then move them somewhere after I'm done with them. The current setup requires an extra step where I physically change the displayed directory in the dialog to 'Home'.

So, the short version, how can I change the default 'Open' location from 'Recently Used' to 'Home' (so that it always opens by default to 'Home'). Is there even a way??

jdkaye 05-04-2013 03:33 AM

I use KDE rather than xfce4. I can't replicate your problem. Whenever I save a file with, say, kate, libreoffice or kwrite I'm always offered the folder in which I opened the file. If I open a file in ~/Documents then it will save any changes to ~/Documents. If I open a file (as root or using sudo) from /etc/apt then it will save changes to /etc/apt unless I explicitly tell it otherwise.
Quote:

So, the short version, how can I change the default 'Open' location from 'Recently Used' to 'Home' (so that it always opens by default to 'Home'). Is there even a way??
On the above named apps "Open" and "(Open) Recent Documents" are distinct menu items in the File menu. I'm quite surprised that XFCE works so differently. On my system "Open" defaults to ~/Documents but I can change that if I wish.
jdk

273 05-04-2013 04:00 AM

I have been googling around and the program which handles opening and saving files seems to be GTKFileChooser. Sadly the only settings for this appear to be in .config/gtk-2.0/gtkfilechooser.ini and there doesn't seem to be anything or any consequence you can change.
Well, there is an XML file under /etc/ too but I took a look at part of the source for gtkfilechooser and there doesn't seem to be a mechanism for passing a folder to open as default.

radiodee1 05-04-2013 06:45 AM

this is a discussion of the same thing. Thank you 273. There is no good solution though.

http://askubuntu.com/questions/63202...chooser-dialog

mrider 06-07-2013 12:14 PM

[ rant mode on ]
Gadzooks what an obnoxious choice the Gnome devs have made! No doubt if someone were to ask them why "Recently Used" is the only default possible, they'd answer "Because **** you, that's why". I love XFCE, but I swear, I'm tempted to try a different environment because of this. If any of the XFCE developers are looking at this forum - I'd suggest tweaking the Gnome source such that there's a simple way around this. It's awful!
[ rant mode off ]

I don't have a "solution", but I found a tweak that makes this more livable, at least in Debian Wheezy...

Open ~/.local/share/recently-used.xbel for edit. Tweak the entries so that places you normally will save are part of the "Recently Used" list for the applications you are interested in, and remove EVERYTHING else. For example, my recently-used.xbel looks like this:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"
      xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
      xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
  <bookmark href="file:///home/mrider/Documents/" added="2013-06-07T16:47:28Z" modified="2013-06-07T16:47:28Z" visited="2013-06-07T16:47:28Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="text/plain"/>
        <bookmark:applications>
          <bookmark:application name="scite" exec="&apos;scite %u&apos;" modified="2013-06-07T16:47:28Z" count="1"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>
  <bookmark href="file:///home/mrider/Documents/Source" added="2013-06-07T16:47:28Z" modified="2013-06-07T16:47:28Z" visited="2013-06-07T16:47:28Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="text/plain"/>
        <bookmark:applications>
          <bookmark:application name="scite" exec="&apos;scite %u&apos;" modified="2013-06-07T16:47:28Z" count="1"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>
</xbel>

That ensures that for me "~/Documents" and "~/Documents/Source" are the only things in "Recently Used". And since those are directories, I can quickly click one and get to the directory I want.

But, unfortunately, that isn't enough for the Gnome folks - oh no. I tried setting the file owner to root and the file permissions to 444, and even that didn't keep it from being written. Apparently the Gnome process which is owned by root writes that file. Which means that the desktop can overwrite the file no matter what you do.

So to finalize it, I wrote a quick Perl script that nukes the file from orbit and puts in what I want, and only what I want. I then put a application starter link on my desktop (so I can run it on demand), and also in my startup group (so it starts clean) that runs my script.



I would LOVE to find a better solution though. Man this is annoying!

[edit] I'm considering adding a cron job that checks the file periodically and nukes it automatically. Haven't done that yet though. :)

273 06-07-2013 12:24 PM

Thanks for the hint, I'll look at that file.
Might setting the immutable bit work instead of changing the permissions?

mrider 06-07-2013 12:33 PM

I didn't think of that, but on my system at least, all that did was make the list blank but left me in that choice. So for me at least, that isn't an improvement. Although it does appear as if it blocks writes.


[edit] I take that back, that worked perfectly. I had goofed up my file when I was copy/pasting it here such that the two entries didn't work. It wasn't the chattr that caused it at all.

Good suggestion!! Thanks!

273 06-07-2013 12:50 PM

Quote:

Originally Posted by mrider (Post 4967336)
Good suggestion!! Thanks!

You're welcome. Now you've tested it out on your system I may tinker with mine. ;)


All times are GMT -5. The time now is 02:01 AM.