Nautilus Window Restoring

Is it really that hard for a program to restore the windows that were open when you logged out? One of the things I liked about OS X was that it remembered the open file manager windows and folders. The default file manager on Ubuntu, Nautilus (Gnome Files), doesn’t do that. It just opens your Home folder. I wrote a couple of python scripts to remedy the situation.

Step one was to figure out how to determine the folders that were open. I found a Nautilus D-Bus entry that contains the window ID and folder for each open window.

The next step was to get the window positions and sizes. For this I used Xlib.

The source code is in the NautilusWinMon github project.

This is a Nautilus LocationWidgetProvider that gets notified whenever the user changes folders in a window. This spawns to save the current window positions/sizes and folders. This has to be done asynchronously because otherwise the Nautilus process would be talking to itself via D-Bus and would deadlock until D-Bus timed out.

This is called asynchronously by and saves the current Nautilus window positions and folders to a configuration file. It uses D-Bus to get the window IDs and folders. Then uses Xlib to get the window positions and sizes.

This is called at login to restore the Nautilus windows. It shell execs nautilus for each window/folder, then uses Xlib to position and size each window.


The Ubuntu window manager Compiz, places an invisible 8 pixel border around a resizable window to capture window resizing events. When programmatically positioning a window, Compiz will not let you move the resizing border offscreen. When positioning a window manually, Compiz will let you move the resizing border off screen. This means that even though you can position a Nautilus window in a corner with no visible gap, when the window is restored, the resizing gap will appear.

31 thoughts on “Nautilus Window Restoring”

  1. Terrific work! This is the type of information that should be shared around the net. Shame on the search engines for not positioning this post higher! Come on over and visit my web site . Thanks =)

  2. Hey! Someone in my Facebook group shared this site with us so I came to take a look.
    I’m definitely loving the information. I’m bookmarking
    and will be tweeting this to my followers! Excellent blog and amazing
    style and design.

  3. I’ve been browsing online more than three hours these days, yet I by no means found any fascinating article like yours. It is lovely worth sufficient for me. In my view, if all web owners and bloggers made good content as you probably did, the net will likely be much more helpful than ever before. “I think that maybe if women and children were in charge we would get somewhere.” by James Grover Thurber.

  4. We’re a group of volunteers and opening a brand new scheme in our community. Your web site offered us with valuable information to paintings on. You’ve done an impressive task and our whole neighborhood will probably be thankful to you.

  5. I do love the manner in which you have framed this problem and it does indeed give us a lot of fodder for thought. Nevertheless, through what I have personally seen, I just trust when other commentary pack on that folks remain on point and don’t get started upon a soap box involving the news of the day. Still, thank you for this superb piece and though I can not go along with it in totality, I regard the standpoint.

  6. Wonderful work! This is the kind of info that should be shared around the net. Shame on the seek engines for no longer positioning this publish higher! Come on over and discuss with my web site . Thanks =)

  7. Please let me know if you’re looking for a article writer for your blog. You have some really good articles and I believe I would be a good asset. If you ever want to take some of the load off, I’d really like to write some articles for your blog in exchange for a link back to mine. Please shoot me an e-mail if interested. Regards!

  8. I do agree with all the ideas you’ve presented in your post. They’re really convincing and will definitely work. Still, the posts are too short for beginners. Could you please extend them a bit from next time? Thanks for the post.

  9. An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!

  10. Aw, this was a very nice post. In concept I would like to put in writing like this moreover – taking time and actual effort to make a very good article… however what can I say… I procrastinate alot and certainly not appear to get something done.

  11. great post, very informative. I wonder why the other experts of this sector do not notice this. You must continue your writing. I’m confident, you’ve a great readers’ base already!

  12. With havin so much content and articles do you ever run into any problems of plagorism or copyright violation? My site has a lot of exclusive content I’ve either authored myself or outsourced but it seems a lot of it is popping it up all over the internet without my authorization. Do you know any ways to help stop content from being ripped off? I’d truly appreciate it.

  13. Thanks on your marvelous posting! I certainly enjoyed reading it, you will be a great author.I will make certain to bookmark your blog and will eventually come back down the road. I want to encourage that you continue your great work, have a nice evening!

  14. It’s a shame you don’t have a donate button! I’d most certainly donate to this fantastic blog! I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to new updates and will share this blog with my Facebook group. Chat soon!

  15. I would like to show my appreciation to this writer for bailing me out of such a predicament. As a result of exploring throughout the search engines and meeting notions that were not beneficial, I figured my life was gone. Living without the strategies to the issues you’ve sorted out by means of this review is a critical case, and the ones which could have adversely affected my career if I hadn’t noticed your blog. Your main expertise and kindness in dealing with every item was vital. I don’t know what I would’ve done if I had not discovered such a stuff like this. I can at this moment look ahead to my future. Thanks for your time so much for this high quality and effective help. I won’t think twice to recommend the website to anybody who would like counselling on this area.

  16. I have not checked in here for a while since I thought it was getting boring, but the last several posts are great quality so I guess I will add you back to my everyday bloglist. You deserve it my friend 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *