Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Problem: I have some bookmarks in Nautilus (v3.8.2) that point to folders that are part of a Truecrypt volume that I mount after logging into the system. The problem is that as this happens after logging in, Nautilus during the session start cannot find them and thus ignores them so they don't appear in the left panel.

Workaround #1: I can open the Nautilus' bookmarks editor, rearrange the bookmarks back and forth and Nautilus reloads their list in the left panel. However, it's annoying to do it manually all the time.

Workaround #2: I can kill Nautilus as suggested in another question and when I start it again, it shows all the bookmarks. Unfortunately this requires opening Nautilus because after killing it, all the desktop icons disappear.

QUESTION: Is there some other way I can force this reload? Something I could incorporate into a bash script and make it happen automatically few minutes after the session start.

Note: Please, don't suggest use of another file manager. I know that for example Nemo doesn't have this problem but this question is about finding solution for Nautilus.

share|improve this question
    
How about a startup script that watches the mount point of the encrypted volume and restarts Nautilus? –  muru Jul 17 at 11:01
    
Yes, that would be good. It seems you added your comment at the same time as I edited my question adding workaround #2. It's the "restart Nautilus" that doesn't seem to be easy. –  cascaval Jul 17 at 12:01

1 Answer 1

up vote 1 down vote accepted

Restarting nautilus is fairly easy:

nautilus -q
nautilus -n &
disown

Unfortunately sometimes this sequence of commands doesn't work, probably due to some race condition. And so we might have to do a pkill or killall.

To watch the mount point directory of the encrypted volume, you can poll a file within it:

FILE=/path/to/some/file/in/encrypted/volume
while sleep 10s; do
    if [[ -f $FILE ]]; then
        pkill nautilus # or nautilus -q
        nautilus -n &
        disown
        exit
    fi
done

I mistakenly assumed that inotify could be used, but it can't since mounting is involved.

share|improve this answer
    
Killing Nautilus works fine. :-) It's the starting again that doesn't seem to work. It hangs with the message "Could not register the application: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)" –  cascaval Jul 17 at 12:40
    
Wait a second... I have now been playing with it and it actually sometimes works and sometimes doesn't. It always produces some warning/error messages and it never exits for some reason but it does start nautilus half of the time. –  cascaval Jul 17 at 12:48
    
@cascaval Ah. In the system in which I tested, it always gave an error message similar to that. Does forcing a sequence between the kill and start change things? nautilus -q && nautilus -n? –  muru Jul 17 at 13:13
    
No, that doesn't change anything. Sometimes it fails with the error message I already mentioned, sometimes it works while producing other messages. –  cascaval Jul 17 at 13:25
1  
Oh, alright, that's good then. In my case I'm checking for a bookmarked directory inside the mounted volume, so the check would return true only if the volume is mounted. Anyway, let's leave this finally. Thanks again for your support! –  cascaval Jul 18 at 9:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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