Save Unity Desktop Session

Solution 1:

I have made a workaround that is a script that helps to configure your session.

Download it here.
Make it executable and run from terminal ./session.config

You can view the code of script ( https://www.dropbox.com/s/w1btmead93q6hze/session.config?dl=0 ), there are explanations in each part. It will create a startup script which will move to each viewport and open the specified application.

Also you can run it whenever you want just press Alt + F2 and paste ~/.sessionconf.

Removing

To remove any changes made by my script just delete this files:

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

Or run this at terminal:

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

Solution 2:

You can do this: killall gnome-session. As we know that entering the command sudo gnome-session-save --logout will log out the system. This will save the current session on Unity. I have tried this.

Or may be you can read about how to make a program auto-start everytime you log in.

Or you can try this gconf-editor key:

/apps/gnome-session/options/auto_save_session = true

Solution 3:

No - as you've described it is not currently possible on Ubuntu versions 11.04 and up.

You may read this bug report, comment 24 in particular

https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/771896

or here is a more complete explanation (too long to copy here)?

https://lists.ubuntu.com/archives/ubuntu-desktop/2011-January/002734.html

Solution 4:

This script works great for me on Xubuntu. It's more or less desktop-agnostic and in theory should also support Unity. From the original blog post by Arnon Weinberg:

GNOME session save and restore

This script is used to save and restore a desktop session.

Why this script?

Some desktop managers do offer some session management features. Under GNOME it may be possible to run gnome-session-properties manually and turn on “Automatically remember running applications when logging out”. However, some GNOME implementations (notably Ubuntu’s) appear to be deemphasizing or deprecating this feature in favour of the Suspend or Hibernate feature.

Both the automated session save and suspend feature however are limited to saving/restoring sessions only on clean logout/login.

I use this script because sometimes I just need to reboot, and sometimes I like to restore my session to a previous state.

How to use:

Download the script, place it on your PATH, and be sure to give it executable permissions.

To save the current session:

session save

To restore the saved session:

session restore

Installation on Ubuntu

The installation instructions provided in the blog post are valid for Fedora. On Ubuntu you will have to install the following dependencies:

sudo apt-get install perl wmctrl xdotool x11-utils

Please make sure to check out the 'Details' section of the original blog post to find out more about the different session restore levels.


Update: another user reported that the script only worked with the first line being #!/usr/bin/perl instead of #!/bin/perl.