You have made some apps running in your Ubuntu and don't want to stop the process, just managed your windows and opened your stuffs needed to work. Then, after much work, suddenly you have battery low in your machine and you have to shut down it. No worries! Because, we can configure our Ubuntu machine to remember all the running applications and restore them as it is in the next login.
We will gonna use the dconf-editor in order to configure our Ubuntu machine. It is the replacement to the gconf-editor available in previous releases of Ubuntu but is not preinstalled by default. To install the dconf-editor, you need to run sudo apt-get install dconf-editor.
$ sudo apt-get install dconf-tools
Once the dconf-editor is installed, you can open dconf-editor from Application Menu. Or you can run it from terminal or run command (alt+f2):
After dconf Editor opens, we'll simply click to the “org” option in the left pane to expand that branch of the tree.
Under “org”, we'll gonna enter the “gnome” option by clicking to it.
Then, we'll select “gnome-session” in the left pane which will display the fields in the right pane. In the right pane, we'll select the “auto-save-session” check box to turn on the option.
After you check or tick it, close the “Dconf Editor” by clicking the close button (X) in the upper-left corner of the window which is by default.
The next time you log out and log back in, all of your running applications will be restored.
Hurray, we have successfully configured our Ubuntu 14.04 LTS "Trusty" to remember automatically running applications from our last session.
Now, on this same tutorial, we'll gonna also learn how to enable hibernation in our Ubuntu 14.04 LTS:
Before getting started, press Ctrl+ALt+T on your keyboard to open the terminal. When it opens, run:
$ sudo pm-hibernate
After your computer turns off, switch it back on. Did your open applications re-open? If hibernate doesn’t work, check if your swap partition is at least as large as your available RAM.
You can check your Swap Area Partition Size from System Monitor, you can get it from the App Menu or run command in terminal.
Enable Hibernate in System Tray Menu:
The indicator-session was updated to use logind instead of upower. Hibernate is disabled by default in both upower and logind.
To re-enable hibernate, run the commands below one by one to edit the config file:
$ sudo -i # cd /var/lib/polkit-1/localauthority/50-local.d/ # gedit com.ubuntu.enable-hibernate.pkla
Tips: if the config file does not work for you, try another one by changing /var/lib to /etc in the code.
Copy and paste below lines into the file and save it.
[Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes
[Re-enable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate ResultActive=yes
Restart your computer and done.
Hibernate your laptop when lid is closed:
1.Edit “/etc/systemd/logind.conf” via command:
$ sudo nano /etc/systemd/logind.conf
2. Change the line #HandleLidSwitch=suspend to HandleLidSwitch=hibernate and save the file.
3. Run command below or just restart your computer to apply changes:
$ sudo restart systemd-logind
That’s it. Enjoy! Now, we have both dconf and hibernation on :) Now, your Ubuntu will completely remember your opened apps and stuffs.