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?
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.
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:
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:
Press Ctrl+S
to save, and Ctrl+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"
if (g_getenv ("GNOME_SESSION_SAVE") != NULL) maybe_load_saved_session_apps (manager);
gnome-session
from source. That makes the Options checkbox show up again, but it does nothing.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.
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 :-)
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.
Start the terminal with Ctrl+Alt+T
sudo apt-add-repository ppa:tuxonice/ppa -yand 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
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.
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.
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
Restart, and you should see the Hibernate option as shown below:
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.
Not remember & start same session
... When starting a new session with the apps (terminal
and firefox
), even on the same login, Remember the last-used window size and position
. This will save lots of time of trying to re-position and re-size app on every session... every time the app is run.
Dec 14, 2015 at 14:46
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.
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.
window postion | size
Here are some random bug reports from some simple search in the bug tracker e.g. "remember window position".
2013 2012When using Compiz; Firefox always starts in top-left corner 198328
Place Windows
... details at: askubuntu.com/a/708984/29012.
Dec 14, 2015 at 17:25
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.
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.
terminal
or firefox
app, adjusting the window size and position, then when you start it again, the size and position are the one you just set. He's not trying to recall a previous session. He just wants to the terminal
or firefox
app start at the last size and position. A new session/the same size and position from the same app.
Dec 14, 2015 at 9:55
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 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
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 :)
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 :
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.
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
Here are the tarballs:
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.