From c0f7c38237947903416f3699b8b4885cf21fc7cc Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Mon, 13 Jul 2009 01:13:21 +0200 Subject: [PATCH] awful.layout: also arrange on client tag change Signed-off-by: Gregor Best Signed-off-by: Julien Danjou --- lib/awful/layout/init.lua.in | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index 7cabfbc7b..d730a0b8b 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