I've noticed some strange behaviour of magnifier layout when new
floating client appears in awesome 3.4. The new floating window
receives focus, but it is not placed on top. So if floating window
is smaller than the primary tiled window, it is not visible, so user
has to switch to next client and than back to previous.

The simplest reproducer:
  - switch to magnifier layout
  - spawn few xterms
  - spawn kdialog --inputbox XXX

I'm not sure if this is a bug or a feature, nevertheless it is very
annoying.

I have attached a patch against master/next branches that fixes
this. It works but I'm not sure if this is a correct solution. It
remembers the originally focused window, and raises it at the end of
arrange function.

-- 
Regards,
Paweł Zuzelski
diff --git a/lib/awful/layout/suit/magnifier.lua.in 
b/lib/awful/layout/suit/magnifier.lua.in
index 2d4a526..74a2398 100644
--- a/lib/awful/layout/suit/magnifier.lua.in
+++ b/lib/awful/layout/suit/magnifier.lua.in
@@ -34,6 +34,11 @@ function arrange(p)
         fidx = 1
     end
 
+    -- If focused window is floating, value of focus will change. We want to
+    -- save original value of focus and raise() it after seting geometry of
+    -- other clients.
+    local originalfocus = focus
+
     -- If focused window is not tiled, take the first one which is tiled.
     if client.floating.get(focus) then
         focus = cls[1]
@@ -56,7 +61,6 @@ function arrange(p)
         geometry.height = area.height
     end
     focus:geometry(geometry)
-    focus:raise()
 
     if #cls > 1 then
         geometry.x = area.x
@@ -87,6 +91,11 @@ function arrange(p)
             geometry.y = geometry.y + geometry.height
         end
     end
+
+    -- Raise primary tiled window and then the originally focused window. If
+    -- there was no floating window it is the same window.
+    focus:raise()
+    originalfocus:raise()
 end
 
 name = "magnifier"

Reply via email to