From 6e8b4f99f84f47415ad89204dd0b840416de1772 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 24 Jul 2016 16:36:03 +0200 Subject: [PATCH] awful.layout: Move clients if a screen is moved Fixes: https://github.com/awesomeWM/awesome/issues/976 Signed-off-by: Uli Schlachter --- lib/awful/layout/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 1041067b..88e8b866 100644 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -277,6 +277,20 @@ end capi.client.connect_signal("request::geometry", layout.move_handler) +-- When a screen is moved, make (floating) clients follow it +capi.screen.connect_signal("property::geometry", function(s, old_geom) + local geom = s.geometry + local xshift = geom.x - old_geom.x + local yshift = geom.y - old_geom.y + for _, c in ipairs(capi.client.get(s)) do + local cgeom = c:geometry() + c:geometry({ + x = cgeom.x + xshift, + y = cgeom.y + yshift + }) + end +end) + return layout -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80