How to save and restore a desktop layout in MATE

I have read and tried a solution posted in the answer to what is essentially the same question as Is there a way to store the current desktop layout? with the result:

ykarant@equality-HP-ZBook-15-G2:/opt/ykarant$ ./recall-windows -read
Traceback (most recent call last):
  File "./recall-windows", line 87, in <module>
    read_windows()
  File "./recall-windows", line 32, in read_windows
    res = get_res()
  File "./recall-windows", line 26, in get_res
    curr_vpdata = [int(n) for n in vp_data[5].split(",")]
  File "./recall-windows", line 26, in <listcomp>
    curr_vpdata = [int(n) for n in vp_data[5].split(",")]
ValueError: invalid literal for int() with base 10: 'N/A'

Ubuntu 20.04 LTS current, MATE current.

After a "glitch", when the desktop started, all of the icons that represent applications on my desktop were moved about on the desktop, some stacked upon one another. I am looking for a mechanism to "save" the current desktop configuration (not necessarily which applications were open, nor on which Workspace Switcher virtual desktop such applications were open -- merely the actual layout of the desktop icons).

Is there an application or "script" that does this "save and restore" for MATE or for other equivalent GUI interfaces? If the suggestion is to post this item to a MATE list, I will try that as well -- but this more general list might find an "outside MATE" solution of which the MATE list participants might be unaware.


Solution 1:

Currently we have about four alternative solutions:

  1. Built-in MATE session restore functionality

    To use go to MATE Control Center, select Startup Applications (or directly by mate-session-properties), switch to Options tab and check Automatically remember running applications when logging out and then logout or reboot.
    Limitations: works best mainly with GTK-based applications.

  2. Setup special application named RaySession to your needs.

    Install it by sudo apt-get install raysession

    See its manual for details.
    It is wmctrl-based, so should do the job.
    Limitations: does not restore window geometry.

  3. xsm or xsession-manager project from GitHub

    Relies on wmlctrl too.
    Limitations: none.

  4. Mature Perl script named session. The documentation is located in the Arnon Weinberg's blog.

    Installation is possible by:

    sudo apt-get install wmctrl
    
    wget https://github.com/arnon-weinberg/session/raw/master/session
    chmod +x session
    sudo mv session /usr/local/bin
    

    Then use the following syntax:

    • session save: Save session in default location (see below)
    • session restore existing: Restore geometries of existing windows
    • session restore matching: Restore geometries of matching windows [default]
    • session restore missing: Restore geometries of missing windows

    Limitations: none.