Files
awesome-dotfiles/awesome/utils/remember_positions.lua
Rainer Bendig 9b3266a32e ...
Signed-off-by: Rainer Bendig <hexathos@mailbox.org>
2020-02-25 23:55:12 +01:00

34 lines
1.3 KiB
Lua

-- Alexander Tsepkov, 2015
--
-- By default awesome forgets window positions when you switch between layouts, this is especially a problem
-- for floating layout, which awesome wasn't designed to handle gracefully out of the box. This tidbit of code
-- fixes that issue by remembering window positions in floating layout and coming back to the same positions when
-- you return to floating layout from a tiling one.
local awful = require("awful")
floatgeoms = {}
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(floatgeoms[c.window])
end
end
client.connect_signal("unmanage", function(c) floatgeoms[c.window] = nil end)
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
floatgeoms[c.window] = c:geometry()
end
end)
client.connect_signal("unmanage", function(c) floatgeoms[c.window] = nil 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
floatgeoms[c.window] = c:geometry()
end
end)