How to restore the last running application when logging on again in Ubuntu

Source: Internet
Author: User
Tags sleep function
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-editorBut 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-editorCommand:

  1. $ sudo apt-get install dconf-tools

Oncedconf-editorAfter 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+f2Run the following command to start it:

  1. $ 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+TTo enable the terminal. After it is enabled, run:

  1. 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:

  1. $ 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:

  1. sudo -i
  2. cd /var/lib/polkit-1/localauthority/50-local.d/
  3. 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:

  1. [Re-enable hibernate bydefaultin upower]
  2. Identity=unix-user:*
  3. Action=org.freedesktop.upower.hibernate
  4. ResultActive=yes
  5. [Re-enable hibernate bydefaultin logind]
  6. Identity=unix-user:*
  7. Action=org.freedesktop.login1.hibernate
  8. ResultActive=yes

Restart your computer.

 

When you cover the cover of your notebook, let it sleep:
  1. Run the following command to edit the file "/etc/systemd/logind. conf ":
    1. $ sudo nano /etc/systemd/logind.conf
  2. Set# HandleLidSwitch = suspend(Pending) This line is changedHandleLidSwitch = hibernate(Sleep) and save the file;
  3. Run the following command or restart your computer to apply changes:
    1. $ 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.