For Linux Cinnamon GUI

Here is the steps:

  1. Install dconf-editor if not exists

    1
    
    sudo apt-get install dconf-editor
    

    NOTE that the package name has been changed to dconf-editor in newest cinnamon environment.

  2. Run dconf-editor

  3. For Cinnamon:

    1. Navigate into /org/cinnamon/cinnamon-session/ by clicking on list item
    2. Check auto-save-session on the config window
    3. After checked, it looks like:

image-20210416104021937

要在 cinnamon 中启用桌面 session 的保存和自动恢复能力,需要用到 dconf-editor,这个工具需要小心谨慎使用:

  1. 安装 dconf-editor

    1
    
    sudo apt-get install dconf-editor
    
  2. 运行 dconf-editor

  3. 选择条目,以便定位到 /org/cinnamon/cinnamon-session/ 位置

  4. 勾选 auto-save-session 选项

For Gnome

Same as cinnamon, you can enable this feature in gnome environment:

  1. Install dconf-editor if not exists

    1
    
    sudo apt-get install dconf-editor
    

    NOTE that the package name has been changed to dconf-editor in newest cinnamon environment.

  2. Run dconf-editor

  3. For Gnome:

    1. Navigate into /org/gnome/gnome-session/ by clicking on list item
    2. Check auto-save-session on the config window

CANNOT Work for Newest Ubuntu

It mentioned at https://askubuntu.com/questions/1084389/automatically-remember-current-running-applications

Ubuntu dropped session saving long ago because it never worked well. Gnome Shell, the desktop environment that Ubuntu 18.04 uses, apparently does not support it as such.

  • Sleep (computer stays on in very low power use mode) and hibernate (computer fully shuts down after saving memory to the hard disk, and reloads the memory content on the next startup) to turn off your computer functionally allow the same, i.e. continue later where you left off. Unfortunately, sleep and hibernate may not work well on your hardware. Sleep works in many cases, but hibernate represents issues on many hardware, to the extent that on Ubuntu, the possibility to hibernate is not enabled by default.
  • Alternatively, you may try the well maintained Gnome Shell extension Window Session Manager.