Hi people,

the attached patch fixes a small annoyance introduced with the
disappearance of the arrange hook. The arrange function wasn't called
when a clients tags were changed, which could be observed like so:

- Start awesome with the default configuration
- launch two terminals on tag 1
- move one of those terminals to tag #2 (most preferably with the
  keybinding Mod5 + Shift + 2)
- notice the remaining client not being resized
- switch to tag 2 and back to tag 1
- the remaining client is now correctly resized

The attached patch fixes that by calling on_arrange(tag.screen) when a
client gets tagged and untagged.

-- 
GCS/IT/M d- s+:- a--- C++ UL+++ US UB++ P+++ L+++ E--- W+ N+ o--
K- w--- O M-- V PS+ PE- Y+ PGP+++ t+ 5 X+ R tv+ b++ DI+++ D+++ G+
e- h! r y+

    Gregor Best
From ec9af7369e3dbca7b455942c1ad98476c050d937 Mon Sep 17 00:00:00 2001
From: Gregor Best <[email protected]>
Date: Mon, 13 Jul 2009 00:56:31 +0200
Subject: [PATCH] awful.layout: also arrange on client tag change

Signed-off-by: Gregor Best <[email protected]>
---
 lib/awful/layout/init.lua.in |   15 +++++++++++++--
 lib/awful/tag.lua.in         |    3 +++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in
index 7cabfbc..d730a0b 100644
--- a/lib/awful/layout/init.lua.in
+++ b/lib/awful/layout/init.lua.in
@@ -10,11 +10,14 @@ local type = type
 local tag = require("awful.tag")
 local util = require("awful.util")
 local suit = require("awful.layout.suit")
-local client = require("awful.client")
 local wibox = require("awful.wibox")
 local ascreen = require("awful.screen")
-local capi = { screen = screen }
 local hooks = require("awful.hooks")
+local capi = {
+    screen = screen,
+    client = client
+}
+local client = require("awful.client")
 
 --- Layout module for awful
 module("awful.layout")
@@ -140,5 +143,13 @@ hooks.clients.register(function()
                            end
                        end)
 hooks.tags.register(function(screen, tag, action) on_arrange(screen) end)
+hooks.tagged.register(function(c, tag)
+    if not tag.screen then return end
+    on_arrange(tag.screen)
+    if not capi.client.focus or not client.focus:isvisible() then
+        local c = client.focus.history.get(tag.screen, 0)
+        if c then capi.client.focus = c end
+    end
+end)
 
 -- vim: 
filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index 04f14fb..d8835f9 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -17,6 +17,8 @@ local capi =
 }
 local hooks = require("awful.hooks")
 
+local tostring = tostring
+local dbg = require("dbg")
 --- Tag module for awful
 module("awful.tag")
 
@@ -82,6 +84,7 @@ end
 -- @param s Screen number.
 -- @return A table with all selected tags.
 function selectedlist(s)
+    dbg.stderr("%s\n", tostring(s))
     local screen = s or capi.mouse.screen
     local tags = capi.screen[screen]:tags()
     local vtags = {}
-- 
1.6.3.3

Attachment: pgpBVPKc7I6WL.pgp
Description: PGP signature

Reply via email to