Save and restore your GNOME desktop window layouts (positions, workspaces, states) and applications with this command-line tool.
Improved version by ismdevteam
- Window state preservation:
- Workspace assignments
- Geometry (position/size)
- States: Maximized, Minimized, Fullscreen, Shaded
- New: "Always on Top" (
_NET_WM_STATE_ABOVE) - New: "Always on Visible Workspace" (
_NET_WM_STATE_STICKY)
- Application restoration:
- Restart missing applications
- Smart window-to-application matching
- Custom commands for special cases (e.g., GNOME Terminal)
- Flexible session management:
- Multiple session profiles
- Partial restoration modes
sudo apt install perl wmctrl x11-utils xdotool
sudo yum install perl wmctrl xorg-x11-utils xdotool
wget https://github.com/ismdevteam/session/raw/main/session
chmod +x session
sudo mv session /usr/local/bin
session save
session restore
session restore missing
session --session=~/work-layout.session save
session --session=~/work-layout.session restore
session --debug=3 restore
session restore existing # Only existing windows
session restore matching # Match windows by properties (default)
session restore missing # Launch missing applications
Edit the %exceptions hash in the script to:
- Add self-managed applications (e.g., Firefox, LibreOffice)
- Define custom launch commands
- Exclude non-application windows
Default location: ~/.config/gnome-session/session.ini Custom paths can be specified with --session Known Limitations
- Application state (e.g., open documents) is not restored - only window layouts
- Some tiled window states (e.g., Super+Left/Right) may not restore perfectly
- Multi-monitor setups may require additional testing
- Full debug output: session --debug=3 restore
- Your desktop environment info
- Session file sample (if relevant)
License
GNU GPLv3 - See LICENSE file.
Based on original work by Arnon Weinberg, with improvements by ismdevteam
- Added new features in the "Features" section (Always on Top/Visible Workspace)
- Reorganized content with clear sections
- Updated dependency instructions for major distros
- Clarified restoration modes and their use cases
- Added troubleshooting guidelines
- Modernized formatting with better Markdown structure
- Removed outdated references to the old version
- Added license notice