- restore geometries of existing windows - restores the window geometry and position (including workspace) for all running windows;
- restore matching windows - restores the window geometry and position (including workspace) for both apps that are still running as well as those that were restarted;
- restore running applications: restores all application windows that were running (even if they are now closed) when the session was saved, along with their position (including workspace) and window geometry;
Important note: The script can only restore app windows that were open when the session was saved and can't restore applications that were running in the background (so to be able to restore an app, that app needs to have at least one open window when the session is saved).
- it doesn't work for every single application. For instance, it can't restore an open Nemo window because Nemo lacks the "--new-window" command line option (which does exist in Nautilus);
- when using "restore 2" (so the apps that aren't running are restored along with their window position and size): there's a delay between launching the app and resizing / positioning its window - that's because the script waits a few seconds to make sure the app actually starts before trying to manipulate its window.
Unity session save and restore script installation and usage
1. The script requires perl, xprop (available in the x11-utils package), wmctrl and xdotool. To install these in Ubuntu, use the command below:
sudo apt-get install perl x11-utils wmctrl xdotool
2. To download my modified script, install it in /usr/local/bin and make it executable, use the following commands:
wget http://raw.githubusercontent.com/hotice/webupd8/master/session -O /tmp/session sudo install /tmp/session /usr/local/bin/ sudo chmod +x /usr/local/bin/session
To save the current session, simply use the following command:
Then, when you want to restore the session, use:
session restore X
where X is:
- 2 - Restore geometries of missing windows (opens any previously running app windows and restores both windows positions and geometries);
- 1 - Restore geometries of matching windows (restores window geometry and position for all running apps, even if they were restarted since the session was saved);
- 0 - Restore geometries of existing windows (restores window geometry and position for apps that weren't closed since the session was saved).
For instance "session restore 2" to restore geometries of missing windows, etc.