1
0
Fork 0

a new cool feature for awesome: save window sizes and positions to restore them when going back to floating

This commit is contained in:
Von Random 2015-03-19 19:47:20 +03:00
parent f324ae248c
commit 7f68f9c9f5

43
rc.lua
View file

@ -140,7 +140,7 @@ tags = {}
saved_layouts = {} saved_layouts = {}
for s = 1, screen.count() do for s = 1, screen.count() do
tags[s] = { name = {}, layout = {} } tags[s] = { name = {}, layout = {} }
saved_layouts[s] = { tiled = {} } saved_layouts[s] = { tiled = {}, float = {} }
end end
-- screen 1 -- screen 1
--tags[1].name = { --tags[1].name = {
@ -701,6 +701,47 @@ client.connect_signal(
client.connect_signal('focus', function(c) c.border_color = beautiful.border_focus end) client.connect_signal('focus', function(c) c.border_color = beautiful.border_focus end)
client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_normal end) client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_normal end)
-- save floating layout parameters for windows created and managed during the current session
tag.connect_signal(
'property::layout',
function(t)
for k, c in ipairs(t:clients()) do
if awful.layout.get(mouse.screen) == awful.layout.suit.floating or awful.client.floating.get(c) == true then
c:geometry(saved_layouts[c.screen].float[c.window])
end
end
end
)
client.connect_signal(
'manage',
function(c)
if awful.layout.get(mouse.screen) == awful.layout.suit.floating or awful.client.floating.get(c) == true then
saved_layouts[c.screen].float[c.window] = c:geometry()
end
end
)
client.connect_signal('unmanage', function(c) saved_layouts[c.screen].float[c.window] = nil end)
client.connect_signal(
'property::geometry',
function(c)
if awful.layout.get(mouse.screen) == awful.layout.suit.floating or awful.client.floating.get(c) == true then
saved_layouts[c.screen].float[c.window] = c:geometry()
end
end
)
client.connect_signal(
'property::floating',
function(c)
if awful.client.floating.get(c) == true and saved_layouts[c.screen].float[c.window] ~= nil then
c:geometry(saved_layouts[c.screen].float[c.window])
end
end
)
-- }}} -- }}}
-- {{{ Autostart -- {{{ Autostart
-- don't forget you sync this file -- don't forget you sync this file