A small tool that captures open windows and their positions and generates a script that can be used to launch those windows again at those positions.
Only tools used are xdotool, xwininfo, xprop which are quite common in Linux. The tool is very easy to use and although not 100% accurate it is very easy to tweak in order to bring to your needs.
- Make sure you are in the same directory as the
winlaunch.py
file. - Run
python winlaunch.py generate-script
A Python script will be generated in the same directory containing a snapshot of all open windows and their location. Feel free to make some alterations to the script since since small errors might be there (terminals tend to all look the same for example).
You can run the script with ./launch_script.py
. To get a better undestanding
of the contents of the script, check the API documentation below.
sudo apt-get install xdotool xprop xwininfo
Function | Description | |
---|---|---|
launch(command) | Runs a GUI application in the background. The window id (wid) is returned and the process id (pid) that the window belongs to. | |
win_size(wid, width, height) | Resizes the window with id wid to given width and height values. If no width and height are given, the current size of the window is returned. |
|
win_pos(wid, x, y) | Moves the window with id wid to the given x and y coordinates. If no x and y are given. the current window position is returned. |
|
win_desktop(wid, desktop) | Sets the window with id wid to the given desktop. If desktop is not given the current desktop of the window is returned. |
|
win_screen(wid) | Gives the current screen where the window with id wid is. |