Welcome to awesome bug tracking system.

FS#759 - remember layout on restart

Attached to Project: awesome
Opened by Vinzent Steinberg (vks) - Tuesday, 27 April 2010, 22:01 GMT
Task Type Feature Request
Category Core
Status Unconfirmed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version 3.4.4
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 3
Private No


If you restart awesome, it seems to remember the client positions, it would be useful to remember also the layout used in each tag. Especially when you try a new configuration.
This task depends upon

Comment by Uli Schlachter (psychon) - Wednesday, 28 April 2010, 16:45 GMT
Awesome does not remember the client positions. Also if it doesn't remember the layout, how could the client positions be the same?

For floating layouts, the X server is what remembers the position. When the window manager exits/restarts, the window just stay at their position. awesome-internal state like layout on the other hand is lost.
I don't really have any idea how this could be implemented. The C code doesn't know about this kind of data and the lua code got no (usable) way of remembering state.
Comment by Vinzent Steinberg (vks) - Wednesday, 28 April 2010, 19:42 GMT
The X server also remembers the postions for non-floating layouts, there is no difference. Awesome could just store the layout for all tags in a file before shutting down and read them on start-up.

It would be great if there would be a shutdown hook exposed to the lua interface, which would be just a function to be called before shutting down. This way, you could even implement this in your lua.rc. But I think it is useful enough to be in the core.

Even better would be KDE-like session handling, where even after a reboot the window manager tries to reopen the applications at the same positions. (KDE applications even have an API to restore the state like for example the opened file.)
Comment by Uli Schlachter (psychon) - Wednesday, 28 April 2010, 19:45 GMT
There is the global exit signal.

awesome:add_signal("exit", function() print("Oh noes, we are going down") end)
Comment by Vinzent Steinberg (vks) - Wednesday, 28 April 2010, 20:36 GMT
Thanks for pointing out! BTW, it does only work with a point instead of a colon:

Comment by Daniel Hahler (blueyed) - Sunday, 30 March 2014, 10:26 GMT
> I don't really have any idea how this could be implemented.

In the meantime there is a X property API, which could be used for this.

I've just done a proof of concept to store the floating property for clients, where fall back to and use the new set/get_xproperty methods.
Since you have to register X properties before they can be used, this does not work in general, but we could use this method for the client properties which are used internally by awesome.

For the layout, information about the layout get stored and restored on the root window.
Comment by Daniel Hahler (blueyed) - Sunday, 30 March 2014, 10:35 GMT
Here is the proof of concept for storing "floating".

The other internal property would be "dockable", not sure if that need to get remembered across restarts?!

diff --git i/lib/awful/ w/lib/awful/
index f72e9be..0c371d2 100644
--- i/lib/awful/
+++ w/lib/awful/
@@ -871,7 +871,17 @@ function, prop)
if[c] then
+ if prop == "floating" then
+ -- bnote("get:"..tostring(c)..':'..prop)
+ if not[c] then
+[c] = {}
+ end
+[c][prop] = c:get_xproperty('prop_'..prop)
+ return[c][prop]
+ end
+awesome.register_xproperty('prop_floating', 'boolean')

--- Set a client property.
-- This properties are internal to awful. Some are used to move clients, etc.
@@ -882,7 +892,11 @@ function, prop, value)
if not[c] then[c] = {}
-[c][prop] = value
+ if prop == "floating" then
+ -- bnote("set:"..tostring(c)..':'..prop..':'..tostring(value))
+[c][prop] = value
+ c:set_xproperty('prop_'..prop, value)
+ end
c:emit_signal("property::" .. prop)
Comment by Daniel Hahler (blueyed) - Wednesday, 09 April 2014, 13:46 GMT
For reference: a pull request for this is being discussed at