Is there a way to save current session (the applications + the organization of windows in desktops) in Unity and load it when needed?
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
or here is a more complete explanation (too long to copy here)?
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
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
To remove any changes made by my script just delete this files:
Or run this at terminal:
rm ~/session.config ; rm ~/sessionconf ; rm ~/sessionconf.bak ; rm ~/.config/autostart/sessionconf.desktop
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
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:
To restore the saved session:
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
dconf write /org/gnome/gnome-session/auto-save-session true
Should enable this for you.
I wrote a little library/command line tool which allow saving and restoring sessions and has support for different monitors setups as well as virtual desktops.
npm install -g linux-window-session-manager
Save the current session to ~/.lwsm/sessionData/DEFAULT.json
Save the current session to ~/.lwsm/sessionData/my-session.json
lwsm save my-session
Restore the session from ~/.lwsm/sessionData/DEFAULT.json
Restore the session from ~/.lwsm/sessionData/my-session.json
lwsm restore my-session
Gracefully close all running apps before starting the session
lwsm restore --closeAllOpenWindows