tabulous: made tabulous tab aware

here is a patch that add tag support for tabulous, so now when a windows is
both tabbed and multiple tagged, it behave as expected (at least by me, that
is do not hide a window in a tag where it is not tabbed)

We can still mess up the tabs by clicking on the window name (in the taskbar)
but this will (I hope) be fixed in another patch.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Maxime COSTE 2008-08-28 16:36:21 +08:00 committed by Julien Danjou
parent 65a285798d
commit 531005453a
1 changed files with 45 additions and 1 deletions

View File

@ -14,7 +14,10 @@ local awful = require('awful')
--- tabulous: fabulous tabs for awesome --- tabulous: fabulous tabs for awesome
module("tabulous") module("tabulous")
local tabbed = {} local tabbed_tags = {} -- all tab tables, indexed by tab
local tabbed = {} -- the current tag tab table
local active_tag
-- Hook creation -- Hook creation
awful.hooks.user.create('tabbed') awful.hooks.user.create('tabbed')
@ -249,7 +252,48 @@ function autotab_start()
end) end)
end end
--- Update the tabbing when current tags changes, by unactivating
-- all tabs that are not in the current tag (and activating the good one).
local function update_tabbing()
-- do nothing if nothing changed
if active_tag == awful.tag.selected().name then return end
-- needed for initialisation
active_tag = active_tag or awful.tag.selected().name
-- save the tabbed list for the old active tag
tabbed_tags[active_tag] = tabbed
-- update the active tag and switch to the new tabbed list
active_tag = awful.tag.selected().name
tabbed = tabbed_tags[active_tag] or {}
-- update show/hide on the clients
for tag,tabs in pairs(tabbed_tags) do
if tag == active_tag then
-- hide all clients that are not tab masters
for i,tab in pairs(tabs) do
for i,c in pairs(tab[2]) do
c.hide = true
end
tab[1].hide = false
end
else
-- unhide all clients
for i,tab in pairs(tabs) do
for i,c in pairs(tab[2]) do
c.hide = false
end
end
end
end
end
-- Update the tabbing when the tags changes
awful.hooks.arrange.register(update_tabbing)
-- Set up hook so we don't leave lost hidden clients -- Set up hook so we don't leave lost hidden clients
awful.hooks.unmanage.register(untab) awful.hooks.unmanage.register(untab)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80