Ubuntu – How could Unity2D save sessions


Until 11.10 I used Kubuntu. For some annoying reasons i migrated to Ubuntu from 12.04. Now i really miss some KDE features and i don't have found solution yet.

First big problem: i work with lot of windows ( >20 ) and i set them on different workplaces. I avoid restarting computer, but sometimes it is neccessary. And then is so tedious to set my workspace up again. Is there some cure for that?

I read already some sources:
Save Unity Desktop Session and https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/771896 and https://lists.ubuntu.com/archives/ubuntu-desktop/2011-January/002734.html.

Is there some change in 12.04? What is the meaning of workplaces, when you need to set them up every time after login?

Best Answer

The feature to save session has been removed in Ubuntu 12.04 because of a bug.

I have made a workaround that is a script that helps to configure your session. Just paste the command below at terminal and press Enter.

This if you are using Metacity (Unity-2d):

cd ~/ && wget -c http://dl.dropbox.com/u/4098082/session.meta.config && chmod +x ~/session.meta.config && ~/session.meta.config


Or this if you are using Compiz (Unity-3d):

cd ~/ && wget -c http://dl.dropbox.com/u/4098082/session.config && chmod +x ~/session.config && ~/session.config

You can view the code of script (1, 2). There are explanations in each part. It will create a startup script which will move to each viewport (or desktop) and open the specified application.


To remove any changes made by my script just delete this files (if they exists):

  • ~/session.config
  • ~/session.meta.config
  • ~/sessionconf
  • ~/sessionconf.bak
  • ~/.config/autostart/sessionconf.desktop

Or run this at terminal:

rm ~/session.config ; rm ~/session.meta.config ; rm ~/sessionconf ; rm ~/sessionconf.bak ; rm ~/.config/autostart/sessionconf.desktop  

There are others workarounds like 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."

See it working here.

You can install it through "tuxonice/ppa":
1) Add the ppa: sudo apt-add-repository ppa:tuxonice/ppa
2) Update: sudo apt-get update
3) Install sudo apt-get install tuxonice-userui linux-generic-tuxonice linux-headers-generic-tuxonice

A third idea is to set Compiz to launch windows in selected viewports:

1) Install CompizConfig-Settings-Manager,

2) Open Alt + F2 and type ccsm and hit Enter,

3) Go to "Place Windows"

enter image description here

4) Select "Fixed Window Placement" > "Window with fixed viewport" > "New"

enter image description here

5) Select the window by class, id, title, name, type or role and set the viewport it should be placed:

enter image description here

enter image description here

6) Now add your apps to "Startup Applications" (press Super and type Startup Applications)