In your Ubuntu, if you need to handle some work, you do not need to close those running applications, just manage the window and open the applications required for the work. However, if you need to leave to handle other things or your machine has low power so that you have to shut down your computer immediately, these programs may have to be shut down and terminated. Fortunately, you can make Ubuntu remember all the applications you are running and restore them at your next login. Automatically save the session now, in order to make our Ubuntu
In your Ubuntu, if you need to handle some work, you do not need to close those running applications, just manage the window and open the applications required for the work. However, if you need to leave to handle other things or your machine has low power so that you have to shut down your computer immediately, these programs may have to be shut down and terminated. Fortunately, you can make Ubuntu remember all the applications you are running and restore them at your next login.
Automatically save session
Now, we will usedconf-editor
. This tool replaces the one installed in the previous Ubuntu version.gconf-editor
But by default, the current Ubuntu version (note: this refers to Ubuntu 14.04 LTS) is not installed. To installdconf-editor
, You need to runsudo apt-get install dconf-editor
Command:
$ sudo apt-get install dconf-tools
Oncedconf-editor
After the installation is complete, you can open it from the application menu (note: this refers to Unity Dash), or you can run it directly on the terminal, or usealt+f2
Run the following command to start it:
$ dconf-editor
In the "dconf Editor" window, click the right arrow next to "org" in the left pane to expand the branch of this option.
Click the right arrow next to gnome under org.
Click "gnome-session" under "gnome ". In the right pane, select the "auto-save-session" option box and enable it.
After you check the options, click the close button (X) in the upper left corner of the window by default to close "Dconf Editor ".
When you log out and log back, all the applications you are running can be restored.
Cheers! We have successfully configured our Ubuntu 14.04 LTS "Trusty" to automatically remember the application that was running in our last session.
In addition to restoring applications after shutdown, similar functions can be achieved through sleep.
Sleep Function
Now, in this tutorial, we will also learnHow to enable sleep in Ubuntu 14.04 LTS:
PressCtrl+Alt+T
To enable the terminal. After it is enabled, run:
sudo pm-hibernate
Turn it on again after your computer is turned off. At this time, has the application you enabled been re-opened? If the sleep function does not work, check the swap partition size. It must be at least the same size as the available RAM.
You can view the swap partition size in the system monitor. The system monitor can enable it by running the following command in the Application menu or terminal:
$ gnome-system-monitor
Enable sleep in the system tray:
The session indicator in the system tray now uses logind instead of upower. By default, the sleep menu is disabled in upower and logind.
To enable its sleep menu, run the following commands to edit the configuration file:
sudo -i
cd /var/lib/polkit-1/localauthority/50-local.d/
gedit com.ubuntu.enable-hibernate.pkla
Tip: If this configuration file does not work for you, replace/var/lib in the above Code with/etc to try another configuration file.
Copy and paste the following code into the file and save it:
[Re-enable hibernate bydefaultin upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate bydefaultin logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes
Restart your computer.
When you cover the cover of your notebook, let it sleep:
- Run the following command to edit the file "/etc/systemd/logind. conf ":
$ sudo nano /etc/systemd/logind.conf
- Set# HandleLidSwitch = suspend(Pending) This line is changedHandleLidSwitch = hibernate(Sleep) and save the file;
- Run the following command or restart your computer to apply changes:
$ sudo restart systemd-logind
That's it. Succeeded? Now we have set dconf and enabled the sleep function :) so that whether you shut down or close the laptop lid directly, your Ubuntu will be able to fully remember the applications and windows you opened.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-04/116496.htm