Save and restore Cinnamon workspaces

cinnamon
window-manager

#1

Hi community,

i would like to save the layout of a single workspace (all running apps with window position and size) and restore it when needed.
I’m not looking for a “auto save session” feature.
I want to save and restore custom workspace layouts manually.

I know i3 offers this feature
https://wiki.archlinux.org/index.php/i3#Save_the_current_window_layout_of_a_single_workspace

Is something like that possible with Cinnamon?
Thanks for your ideas!


#2

As far as I know this is not possible out of the box with Cinnamon.

Your question reminded me that this is something I wanted to solve myself, so I did some searching.

The most useful option appears to be an app called gdevilspie which is available from the AUR. It’s fairly old and unmaintained, and I haven’t tried it myself yet, so I might just be a dud. More info here.

This might also be possible to achieve by using Compiz and using the Compiz Settings Manager, but personally I’m not very much inclined to start messing around with Compiz if I don’t have to. Some info and more info.

Let me know if you find something that works!


#3

okay, I do not want to deal directly with Muffin.
It looks like there is a possibility to avoid this.
There is a cli tool wmctrl that can be used to interact with the window manager

The rough concept might look like this:

Saving

detect the current workspace
wmctrl -d | grep '*' | cut -d ' ' -f1

getting a list of windows from all workspaces with pid and geometry information
wmctrl -p -G -l

grep only windows from the current workspace

read cmd for all pids and replace NULL with blank
tr '\0' ' ' < /proc/<pid>/cmdline

open a popup window and ask for a profile name

dump all window properties to a file --> cmd,x,y,w,h

Restoring

choose a profile:
use a program start arg or show a list of all profiles

chose workspace:
create a new workspace (wmctrl -n <integer>) or use existing (wmctrl -s <integer>)

read profile file

load each window, wait until it is displayed and get the window id from wmctrl

resize each window to the saved properties

wmctrl -i -r <window id> -e g,x,y,w,h


now i have to tinker a bit :slight_smile:


#4

Here comes an update before Christmas.
I was able to make some progress :slight_smile:
Wrote a little python script as proof of concept.
So far tested with some applications like gnome-terminal, xed or galculator.
Looks promising, but there is still a lot to do.

Demo:

Download from Github

$ pacman -U savedesktop-0.0.1-1-x86_64.pkg.tar.xz

Usage is quite simple:

dump a desktop:

$ sd -d 0 -p profile1 -o

options:

-d 0 dump first desktop

-p profile1 save to ~/.config/savedesktop/profile1.json

-o open in default editor

restore a desktop:

$ rd -d 1 -p profile1

#5

More progress, before the year comes to an end.

:fireworks: :firecracker::sparkler::tada:

I hope the script can be useful, here comes a AUR package for everyone:

https://aur.archlinux.org/packages/savedesktop

I added manpages, menu launcher and a simple gtk interface.

savedesktop

restore

The commands are now more unique: svd and rvd

README

Have a lot of fun with it!

TODO: Testing with other desktop environments


#6

Awesome, thank you. :slight_smile:

Today I found wmctrl, after I’ve been using linux forever, I feel.
Using it for bash script and found your nice work in forum.
I use i3wm + Xfce,so time will come for testing your package in Xfce :slight_smile: ok, I read the manual :smiley:
rd reminds me on rm :crazy_face: :wink:

cu

Maybe the interface help a lot, manage “FF dev edition” in wmctrl

Firefox Developer Edition

but open with terminal you need

firefox-developer-edition

Life could be so easy if everyone used the same syntax. :wink:

On the other hand, it could get boring. :smiley: