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.

When I log in Ubuntu, I would like all windows opened at previous session (terminal and Firefox mainly) to be re-opened automatically at the same size and position.

How to proceed?

share|improve this question
1  
As you can read here this feature became removed. I suggest to change your question and ask for an equivalent workaround to offer the bounty for. –  Jakob May 5 '12 at 13:12
1  
Why? Aren't you able to edit your question since you offered this bounty? Otherwise I would ask something like "Any idea for a workaround?" since this is an interesting question! –  Jakob May 5 '12 at 13:18
1  
"I would like an answer and not a link. Please specify what all I should do so as to solve the problem I'm facing." You will have to get your fingers dirty if you want a method of accomplishing this :+ –  Rinzwind May 5 '12 at 13:52
1  
Bug Reports: here (2007-07-06), here, here (2008-03-21)‌​, here, Other apps: here, here, here. There's more! –  BullfrogBlues May 6 '12 at 22:11
1  
Possible duplicate that gives an appropriate 12.04 answer? - or the dupe should be merged here: askubuntu.com/questions/129339/… –  fossfreedom May 23 '12 at 18:28
show 1 more comment

10 Answers

It doesn't seem to be possible to have all applications remember their last window position and size. This behaviour seems to have been removed a long long time ago. My understanding is that it is the application's responsability to remember its own position and size. And here in lies the rub.

A search through the bug tracker yields many reports that in some way relevant to this issue.

So what applications remember position & size and what versions of Ubuntu do the applications have this functionaility?

Note : Please edit and fill the applications and versions of Ubuntu you have tested for this functionaility. i.e. the application remembers window position and/or size.

Sepecify the version of Ubuntu you have tested and if one or both window postition and size is remembered.

13.04

window postion | size

  • Y, Y - Nautilus
  • N, Y - Firefox erratic mutiple monitor placements
  • N, N - Terminal The terminal has custom settings to remember a specific size everytime, but it will not remember the last position
  • N, Y - Chromium
  • Y, Y - Banshee
  • N, - - Calculator Is not resizable*
  • N, Y - Gedit

Bug Reports Examples

Here are some random bug reports from some simple search in the bug tracker e.g. "remember window position".

2013 2012 2011 2009 2008 2007
share|improve this answer
add comment

12.04

As a workaround you can re-enable hibernation in 12.04 and use it shut down your pc and then wake it up with all your application still in use.

Type in terminal :

sudo gedit /var/lib/polkit-1/localauthority/50-local.d/hibernate.pkla

and then add this string to the text file :

[Re-enable Hibernate]
Identity=unix-user:* Action=org.freedesktop.upower.hibernate
ResultActive=yes

This way :

Valid XHTML

Then hibernate option will be displayed again on shutdown menu :

Valid XHTML

Hope it will help.

share|improve this answer
1  
Thanks for taking time to give your answer. But unfortunately, Hibernation option is not a work around for my question. –  harisibrahimkv May 9 '12 at 13:34
    
what is that app running on desktop? or are they just icons? (angry birds/firefox,etc), its nice... link please :D:D:D:P –  kernel_panic Apr 25 '13 at 7:00
add comment

How to save a session on Ubuntu 11.04 or above:

  1. Download and install DConf-Editor.

  2. Type dconf on the dash and run it.

DASH-IMG

Open the next labels in order: org --> gnome

Then select gnome-session

Now you should see the auto-save-session option as the following image, activate it.

APP-IMG

DONE!

Now when you turn off your computer, the current session will save automatically. The next time you turn it will be exactly as you left.

share|improve this answer
    
This doesn't seem to do anything for application windows remembering size and position. –  BullfrogBlues Aug 16 '13 at 17:59
    
I don't understand what are you trying say. –  Lucio Aug 16 '13 at 23:40
add comment

For 12.04 (and 11.10)

The short answer is: hibernation is the best option because the gnome-session-save functionality was removed after 11.04 since it was buggy, and the official tweak to manually re-enable this functionality does not appear to work. Part B of this answer describes how to use an alternative hibernation method, TuxOnIce, which is more compatible and reliable right now than the built-in hibernation.

A. Trying to enable the old Gnome session saving functionality

  • Note: as described at the end, this official tweak does not appear to work -- you may want to skip directly to B. Hibernation with TuxOnIce
  • This Launchpad bug discusses restoring the "save session" functionality. It is currently marked "fixed", because a patch was introduced in the gnome-session package in April 2012, allowing users to manually re-enable this functionality. The patch describes itself as:

    • add GNOME_SESSION_SAVE environment variable for people wanting to
      use the save session still, knowing that it can break your system
      if used unwisely (LP: #771896)
  • You can enable this by setting the GNOME_SESSION_SAVE variable to a non-null value. Here's how:

    • Press Alt+F2, type gedit ~/.pam_environment, and press enter.
    • Add the line GNOME_SESSION_SAVE=1 at the end of the file as shown below:

    • enter image description here

    • Press Ctrl+S to save, and Ctrl+Q to quit the editor.

    • Now reboot (logout should also work, but just to be safe)
  • What the patch (source) does is disable the Options tab in Startup Applications, which used to contain the Remember running applications when logging out option. BUT it checks the GNOME_SESSION_SAVE variable, and if set (non-null), it should enable session-saving just as if the Remember... box existed and was checked. That's why the bug is labeled as "fixed"
    • if (g_getenv ("GNOME_SESSION_SAVE") != NULL)
                      maybe_load_saved_session_apps (manager);
    • Unfortunately, it doesn't seem to work, as confirmed by comment 32 in the bug tracker.
    • I even tried disabling the patch and rebuilding gnome-session from source. That makes the Options checkbox show up again, but it does nothing.
    • But hey, it may somehow work for you!! :)

B. What works for now: Enhanced Hibernation with TuxOnIce

  • Hibernation saves your current system state (including your session, applications open, etc.) to the hard disk, and shuts the computer down. When you start it again, it reads the saved state and restores it, just as if you had never turned the computer off. This technology is mostly used by laptop users to save on battery power, but there's no reason it can't be used on desktops as well.
  • Hibernation support is available in Ubuntu/Linux but was disabled in 12.04 because it wasn't working properly on a number of systems. See this question and this bugreport if you want more information.

    A more compatible alternative: TuxOnIce

  • TuxOnIce (wiki|homepage) is an alternative to the kernel's built-in hibernation technology, and is supposed to be more compatible, more reliable and more flexible.

  • It is easily installed, and if it doesn't work for you, as easily removed.
  • It does require installing TuxOnIce's custom kernel, but the instructions that follow should make it easy. If you've never opened the terminal before, you may want to now :-)

    0. Requirements

    The only requirement for TuxOnIce is that your swap partition be at least as large as the amount of memory (RAM) you have. You can check this by:

  • Start the terminal with Ctrl+Alt+T

  • Type free -m, and you should see something like this:

                 total       used       free     shared    buffers     cached
    Mem:          1024        731        260          0          0        190
    -/+ buffers/cache:        540        451
    Swap:         1536          6       1530
    
  • The number after Swap: (e.g. 1536) should be more than the number after Mem: (e.g. 1024)

  • If this is not the case, and your swap is smaller than your memory, you must either resize and increase the size of your swap partition, or configure TuxOnIce to use a special swap file. That is beyond the scope of this answer, but if you ask another question and mention it in the comments, I will answer and explain how.

    1. Installing the TuxOnIce kernel

  • Start the terminal with Ctrl+Alt+T

  • Copy and paste the following into the terminal. This adds the TuxOnIce PPA and installs the custom kernel and headers.
    • sudo apt-add-repository ppa:tuxonice/ppa -y
      and once the ppa is added:
    • sudo apt-get update
      sudo apt-get install tuxonice-userui linux-generic-tuxonice -y 
      sudo apt-get install linux-headers-generic-tuxonice -y
  • Now reboot.
  • Ubuntu should now start up with the TuxOnIce kernel. If there are any problems, keep the Shift pressed at startup and you will get the Grub menu. Use the arrow keys to go to Previous Linux Versions, press enter, and press enter again to go back to the working kernel.

    2. Testing hibernation functionality.

  • Open some of the applications you normally use, e.g. Firefox, Thunderbird, LibreOffice, etc.

  • Open the terminal again, with Ctrl+Alt+T.
  • Type sudo pm-hibernate, press enter, enter your password.
  • You should see the lock screen for a second, and then the TuxOnIce hibernation progress screen, like the one below:

    enter image description here

    • If TuxOnIce works, your computer will shutdown.
    • Start it again, and wait. TuxOnIce should resume from the point you hibernated, including all the windows you opened at the position you opened.
  • If all this worked, go to Step 3, which lets you enable Hibernate from the dashboard.

    3. Enabling hibernation from the dashboard

  • Press Alt+F2, type the below and then press enter:

    gksudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
  • Paste the below, press Ctrl+S to save and Ctrl+Q to exit the editor:

    [Re-enable hibernate by default]
    Identity=unix-user:*
    Action=org.freedesktop.upower.hibernate
    ResultActive=yes

    enter image description here

  • Restart, and you should see the Hibernate option as shown below:

    enter image description here

    4. Removing TuxOnIce

    • If TuxOnIce doesn't work for you, or you simply wish to remove it, start the terminal and enter:

       sudo apt-get remove tuxonice-userui linux-generic-tuxonice linux-headers-generic-tuxonice -y
    • and remember to disable the Hibernate option in the menu with:

      sudo rm /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
    • Then restart.

share|improve this answer
3  
This is a really thorough answer but I think the question is 'how to make applications remember their window size and position', even persisting between reboots. Perhaps this isn't even an app setting, maybe the window manager? All current solutions (including devispie) have no effect on Firefox, for example. It opens top right for me, no matter what. Good answer though. The question might need another edit if my understanding is correct. –  Tom Brossman May 29 '12 at 9:58
    
@TomBrossman, it's a little more nuanced, IMO: the OP want's the "state" of the desktop at logout/shutdown restored upon login/bootup, which is technically different than apps remembering their last size/position between instantiations. The consensus is that it has been status quo between the window manager and application development communities for a while now: each believe it is the other side's responsibility to ensure app window parameters are retained. The only true workaround for what you mention is likely to be some sort of wrapper script for each app that saves/restores position. –  izx May 29 '12 at 11:18
1  
This is the most brutal overkill to a simple problem I've ever seen and probably not worth swapping out the hibernation bits and I wouldn't do this to any of my machine, but +150 for a thorough job! –  Jorge Castro May 29 '12 at 23:37
    
I did type " free -m " and I found that my swap number (255) is smaller than the mem's (3841) so I didn't proceed .How can I fix this ? Thanks. –  led-Zepp Mar 26 at 15:41
add comment

1.

CryoPID But It is not very well documented though and the last DEB released was for Heron and the website was last updated in 2005 so it might be useless.

CryoPID allows you to capture the state of a running process in Linux and save it to a file. This file can then be used to resume the process later on, either after a reboot or even on another machine.

CryoPID consists of a program called freeze that captures the state of a running process and writes it into a file. The file is self-executing and self-extracting, so to resume a process, you simply run that file. See the table below for more details on what is supported.

Features

  • Can run as an ordinary user! (no root privileges needed)
  • Works on both 2.4 and 2.6.
  • Works on x86 and AMD64.
  • Can start & stop a process multiple times
  • Can migrate processes between machines and between kernel versions (tested between 2.4 to 2.6 and 2.6 to 2.4).

Here are the tarballs:

2.

Tuxonice probably this is your better bet and may work.

TuxOnIce is most easily described as the Linux equivalent of Windows' hibernate functionality, but better. It saves the contents of memory to disk and powers down. When the computer is started up again, it reloads the contents and the user can continue from where they left off. No documents need to be reloaded or applications reopened and the process is much faster than a normal shutdown and start up.

sudo add-apt-repository ppa:tuxonice/ppa

The PPA has precompiled Ubuntu kernels with TuxOnIce already compiled in, the userui binary and the hibernate script. So it might not be for the fainthearted.


There is one workaround that might be worth looking in to:

  • Create a script that has all the programs you tend to open. Or create 2,3,4,5,6 of those scripts and bind a key to this script. Like control + alt + 1|2|3|4|5|6 or if that is in use something else. Hit the key and let the script open all the programs from that script.

  • And you can use something like this how to shift applications from workspace 1 to 2 using command to toss them onto another workspaces if you want them grouped.

I am not allowed to copy someones answer, so source.

share|improve this answer
1  
You have completely copied and pasted the answer from here (askubuntu.com/questions/129339/…). If you do this in the future - please acknowledge this by adding the citation. –  fossfreedom May 28 '12 at 6:06
    
@fossfreedom Can I post someone's answer? I won't if shouldn't. –  virpara May 28 '12 at 7:34
    
@virpara : this maybe meta, but I acknowledge the source question/answer at the beginning if I'm going to be using any part of it in my answer –  izx May 28 '12 at 7:44
1  
If its part of someone's answer then make it explicit in your answer. Given that you copied 99% of the answer then you should just link to the answer. Please note - I've already linked this Q in a comment of the question. To my mind the two Q's are very similar and may need merging. –  fossfreedom May 28 '12 at 8:31
add comment

In CCSM, use Place Windows and Resize Window plugins.

share|improve this answer
1  
Place Windows appears add some placement algorithms or alternatively requires you to enter rules to match and place windows at particular places. I couldn't get it to simply remember where windows were placed the last time I was logged in. Looks useful, however. –  John S Gruber May 22 '12 at 18:09
2  
Could you provide more details in your answer how to use these plugins to get the desired effect? Thanks! –  WarriorIng64 May 23 '12 at 1:53
add comment

For 11.04 and earlier

Try this

System > Start up Applications > Options and check Automatically remember running applications when logging off and click remember current applications.

share|improve this answer
3  
There is no Options tab, v11.10? –  BullfrogBlues Jan 7 '12 at 16:08
add comment

The current believe is that the proper session saving/restoring feature is to use either suspend or hibernate. I agree though that hibernate and suspend can be a pain to get working if they did not out of the box ...

But have a look at ...

CryoPID

CryoPID allows you to capture the state of a running process in Linux and save it to a file. This file can then be used to resume the process later on, either after a reboot or even on another machine.

CryoPID was spawned out of a discussion on the Software suspend mailing list about the complexities of suspending and resuming individual processes.

CryoPID consists of a program called freeze that captures the state of a running process and writes it into a file. The file is self-executing and self-extracting, so to resume a process, you simply run that file. See the table below for more details on what is supported.

Features

  • Can run as an ordinary user! (no root privileges needed)
  • Works on both 2.4 and 2.6.
  • Works on x86 and AMD64.
  • Can start & stop a process multiple times
  • Can migrate processes between machines and between kernel versions (tested between 2.4 to 2.6 and 2.6 to 2.4).

It is not very well documented though and the last DEB released was for Heron and the website was last updated in 2005 so it might be useless. Here are the tarballs:

And also have a look at Tuxonice

TuxOnIce is most easily described as the Linux equivalent of Windows' hibernate functionality, but better. It saves the contents of memory to disk and powers down. When the computer is started up again, it reloads the contents and the user can continue from where they left off. No documents need to be reloaded or applications reopened and the process is much faster than a normal shutdown and start up.

ppa:tuxonice/ppa 

The PPA has precompiled Ubuntu kernels with TuxOnIce already compiled in, the userui binary and the hibernate script. So it might not be for the fainthearted.


There is one workaround that might be worth looking in to:

  • Create a script that has all the programs you tend to open. Or create 2,3,4,5,6 of those scripts and bind a key to this script. Like control + alt + 1|2|3|4|5|6 or if that is in use something else. Hit the key and let the script open all the programs from that script.

  • And you can use something like this how to shift applications from workspace 1 to 2 using command to toss them onto another workspaces if you want them grouped.

Not what you asked for but it seems we are deemed to look for workarounds :)

share|improve this answer
1  
Hmmm.. I guess it will be a while before enough tweaks on CryoPID can be done before we can make it compatible with the 3.0 kernel. If there is any head way to proceed for the answer to my question, then this is it. Thanks Rinzwind. –  harisibrahimkv May 9 '12 at 13:35
    
Looks like cryopid is dead in the water. tuconice seems hopeful though. Read some positive feedback on it. And no problem @harisibrahimkv I used that option rather alot in the old days (but also have to agree it was very very buggy). I do have another option but not really the time to look into further: how about a script that opens all your programs and sends them to a workspace? xdotool should be able to do this? –  Rinzwind May 9 '12 at 13:38
add comment

You need to enable to see all aplications on the startup-aplication. Run this bash command on a terminal: sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop After that you will see all the aplications in Startup Applications.

I take this tip from this link http://www.webupd8.org/2012/04/things-to-tweak-after-installing-ubuntu.html, maybe it will interest you.

Sorry foy my english!

Saludos!

share|improve this answer
3  
Thanks for the link as I find it very useful. But I fear this is not the answer that I'm looking for. What you have suggested displays the startup applications that actually run upon startup in the startup applications menu. –  harisibrahimkv May 2 '12 at 0:52
add comment

You can enable a feature similar to this. You can do this by having Ubuntu remember the locations and running applications on log off / shut down. To do so navigate to System > Startup Applications and in the Options tab check "Automatically remember running applications when logging off" and press the "Remember current applications" button.

img

share|improve this answer
5  
12.04 doesn't have an options tab in Startup Applications Preferences. –  fragos May 23 '12 at 1:13
add comment

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.