Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to restore the last running application after the Ubuntu system starts

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to restore the last running application after Ubuntu system startup". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "How to restore the last running application after Ubuntu system startup"!

In your Ubuntu, if you need to do some work, you don't have to close the apps that are running, just manage the windows and open the apps that are needed for work. However, these programs may need to be shut down if you need to leave to attend to something else or if your machine runs low on battery power and you have to shut down your computer immediately. Fortunately, though, you can have Ubuntu remember all the apps you're running and restore them the next time you log in.

Auto-save session

Now, in order for our Ubuntu to remember what apps are running in the current session and restore them the next time we log in, we'll use dconf-editor. This tool replaces gconf-editor installed in previous Ubuntu versions, but is not installed by default in the current Ubuntu version. To install dconf-editor, you need to run sudo apt-get install dconf-editor:

The code is as follows:

$ sudo apt-get install dconf-tools

Once dconf-editor is installed, you can open it from the application menu, or you can start it by running it directly from the terminal or using alt+f2 to run the following command:

The code is as follows:

$ dconf-editor

In the "dconf Editor" window, click the right arrow next to "org" in the left pane to expand this option branch.

Then under "org," click the right arrow next to "gnome."

Then click "gnome-session" under "gnome." In the right pane, select the "auto-save-session" option box and turn it on.

After you confirm that you have checked the option, click the Close button (X) located in the upper left corner of the window by default to close the Dconf Editor.

When you log out and log back in, all your running apps can be restored.

Cheers, we've successfully configured our Ubuntu 14.04 LTS "Trusty" to automatically remember apps that were running in our last session.

In addition to resuming applications after shutdown, similar functions can be achieved by hibernating.

sleep function

Now, in this tutorial, we will also learn how to turn on sleep in Ubuntu 14.04 LTS:

Before starting, press Ctrl+Alt+T on the keyboard to open the terminal. After it opens, run:

The code is as follows:

sudo pm-hibernate

Turn your computer off and on again. Is the app you opened reopened? If hibernation doesn't work, check the size of your swap partition to make it at least as large as your available RAM.

You can view your swap partition size in System Monitor, which can be opened by running the following command from the Applications menu or from the Terminal:

The code is as follows:

$ gnome-system-monitor

Enable hibernation in the system tray:

The session indicator in the system tray now uses logind instead of up power. By default, the hibernation menu is disabled in both upower and logind.

To open its sleep menu, edit the profile by running the following commands:

The code is as follows:

sudo -i

cd /var/lib/polkit-1/localauthority/50-local.d/

gedit com.ubuntu.enable-hibernate.pkla

Tip: If this configuration file doesn't work for you, try another configuration file instead of/var/lib in the above code.

Copy and paste the following code into the file and save:

The code is as follows:

[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.

When you close the back of your laptop, put it to sleep:

Edit the file "/etc/systemd/logind.conf" with the following command:

The code is as follows:

$ sudo nano /etc/systemd/logind.conf

Change the line #HandleLidSwitch=suspend to HandleLidSwitch=hibernate and save the file;

Run the following command or restart your computer to apply the changes:

The code is as follows:

$ sudo restart systemd-logind

That's it. Did it work? Now we have dconf set up and sleep enabled:) This way, whether you turn off or close the laptop lid, your Ubuntu will remember exactly what apps and windows you open.

At this point, I believe that everyone has a deeper understanding of "how to restore the last running application after Ubuntu system startup", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report