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?
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?
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
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:You can enable this by setting the
GNOME_SESSION_SAVE
variable to a non-null value. Here's how:Alt+F2
, typegedit ~/.pam_environment
, and press enter.Add the line
GNOME_SESSION_SAVE=1
at the end of the file as shown below:Press
Ctrl+S
to save, andCtrl+Q
to quit the editor.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"gnome-session
from source. That makes the Options checkbox show up again, but it does nothing.B. What works for now: Enhanced Hibernation with TuxOnIce
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 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:The number after
Swap:
(e.g. 1536) should be more than the number afterMem:
(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
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.
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:
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:
Paste the below, press Ctrl+S to save and Ctrl+Q to exit the editor:
Restart, and you should see the Hibernate option as shown below:
4. Removing TuxOnIce
If TuxOnIce doesn't work for you, or you simply wish to remove it, start the terminal and enter:
and remember to disable the Hibernate option in the menu with:
Then restart.
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.
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
Bug Reports Examples
Here are some random bug reports from some simple search in the bug tracker e.g. "remember window position".
2013When using Compiz; Firefox always starts in top-left corner 198328
Positioning of gnome-do window is sometimes erratic 204372
How to save a session on Ubuntu 11.04 or above:
Download and install DConf-Editor.
Type
dconf
on the dash and run it.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.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.
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
Features
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
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 :)
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 :
and then add this string to the text file :
This way :
Then hibernate option will be displayed again on shutdown menu :
Hope it will help.
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.
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!
In CCSM, use the Place Windows and Resize Window plugins.
They are in the Window Management category, in CompizConfig Settings Manager.
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.Features
Here are the tarballs:
2.
Tuxonice probably this is your better bet and may work.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.