a new cool feature for awesome: save window sizes and positions to restore them when going back to floating
This commit is contained in:
parent
f324ae248c
commit
7f68f9c9f5
1 changed files with 42 additions and 1 deletions
43
rc.lua
43
rc.lua
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue