Skip to main content
Working from scratch, following simplicity

Python script to store and load your preferred desktop layout

Are you tired of having to load, place and resize the programs you normally use every time you start your computer? Would you like to have a simple program that does it for you automatically? Do you wish easily to switch from a series of programs oriented to different uses (office, internet, multimedia, CAD and 3D)? In the article I propose all this by presenting an easy-to-use Python script for Ubuntu and derivatives.

Python script to store and load your preferred desktop layout


What is it for?

It takes care of saving in a text file the layout of your favorite applications with their position and size in the correct workspace and uploading them whenever you need them, for example when you start your PC or when you switch from one use to another.

As shown in the video below:

The name of the script is recall_windows and it is written in Python, I found it on askubuntu in this thread Is there a way to store the current desktop layout?.
I have added two features in order to:

  • read and store windows displacement considering also the workspace;
  • add a filename option to have different layout displacements.

How it works: Read

Once loaded, positioned and sized your applications, you have to launch this command:

recall_windows -read
(it will save the layout in a file called .windowlist in your $HOME folder)


recall_windows -read nomefile
(it will save the layout in a file called .nomefile in your $HOME folder)

I always suggest you to check the generated file and eventually fix it, because it doesn't read correctly the binary of the applications and their position, every row contains an application described by 7 columns as follow:

  1. binary of the program
  2. workspace number
  3. program ID
  4. horizontal position in pixel from left to right
  5. vertical position in pixel from top to bottom
  6. width in pixel
  7. height in pixel

In my case it creates this file:

xfce4-terminal 2 26387 652 74 577 357
Thunar 1 1405 2 73 954 1023
corebird 2 26424 -26 2 699 598
opera 2 26443 655 327 1236 868
chrome 0 26624 0 25 1920 1055
gnome-system-mo 2 26809 1222 74 700 523
Telegram 2 2405 3 596 647 500

That I had to correct in this manner:

xfce4-terminal 2 12284 650 26 577 357
Thunar 1 11905 0 25 954 1023
corebird 2 12318 -26 2 699 598
opera 2 12337 653 279 1236 868
chrome 0 12798 0 25 1920 1055
gnome-system-monitor 2 13034 1220 26 700 523
/home/nicola/Programmi/Telegram/Telegram 2 13041 2 572 647 500

How it works: Positioning

In order to store the applications, you have to launch the following command:

nohup ./recall_windows -run
(it stores the file called .windowlist in your $HOME folder)


nohup ./recall_windows -run nomefile
(it stores the file called .nomefile in your $HOME folder)

nohup execute commands after you exit from a shell prompt

Obviously you can create a bash script at boot like this:

#! /bin/bash
sleep 5
wmctrl -s 0
$HOME/Script/recall_windows -run
exit 0


You can download it from GitHub:

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Sponsored Links

Nicola Rainiero

A civil geotechnical engineer with the ambition to facilitate own work with free software for a knowledge and collective sharing. Also, I deal with green energy and in particular shallow geothermal energy. I have always been involved in web design and 3D modelling.