[tabulous] Fix duplicate clients when merging tabbed views

This commit is contained in:
Lucas de Vries 2008-06-11 12:57:12 +02:00 committed by Julien Danjou
parent 734c421ab6
commit 8ac45d9ead
1 changed files with 16 additions and 18 deletions

View File

@ -88,11 +88,13 @@ end
-- Get all clients on a tabbed display -- Get all clients on a tabbed display
local function client_get_clients(tabindex) local function client_get_clients(tabindex)
if tabbed[tabindex] == nil then return nil end
return tabbed[tabindex][2] return tabbed[tabindex][2]
end end
-- Get the displayed client on a tabbed display -- Get the displayed client on a tabbed display
local function client_get_displayed(tabindex) local function client_get_displayed(tabindex)
if tabbed[tabindex] == nil then return nil end
return tabbed[tabindex][1] return tabbed[tabindex][1]
end end
@ -159,6 +161,17 @@ local function client_untab(cl)
awful.hooks.userhook_call('untabbed', {c}) awful.hooks.userhook_call('untabbed', {c})
end end
-- Untab all clients in a tabbed display
local function client_untab_all(tabindex)
for i,c in pairs(tabbed[tabindex][2]) do
awful.hooks.userhook_call('untabbed', {c})
end
if tabbed[tabindex] ~= nil then
table.remove(tabbed, tabindex)
end
end
-- Create a new tabbed display with client as the master -- Create a new tabbed display with client as the master
local function client_tab_create(cl) local function client_tab_create(cl)
local c = cl or client.focus_get() local c = cl or client.focus_get()
@ -187,31 +200,16 @@ local function client_tab(tabindex, cl)
awful.hooks.userhook_call('tabbed', {c}) awful.hooks.userhook_call('tabbed', {c})
else else
-- Merge two tabbed views -- Merge two tabbed views
waiting = {} local clients = client_get_clients(x)
client_untab_all(x)
for i,b in pairs(client_get_clients(x)) do for i,b in pairs(clients) do
client_untab(b)
table.insert(waiting, b)
end
for i,b in pairs(waiting) do
client_tab(tabindex, b) client_tab(tabindex, b)
end end
end end
end end
end end
-- Untab all clients in a tabbed display
local function client_untab_all(tabindex)
for i,c in pairs(tabbed[tabindex][2]) do
awful.hooks.userhook_call('untabbed', {c})
end
if tabbed[tabindex] ~= nil then
table.remove(tabbed, tabindex)
end
end
-- Start autotabbing, this automatically -- Start autotabbing, this automatically
-- tabs new clients when the current client -- tabs new clients when the current client
-- is tabbed -- is tabbed