Merge pull request #612 from Elv13/fix_awful.client_idx

awful.client.idx: Avoid error when called with a floating client
This commit is contained in:
Emmanuel Lepage Vallée 2016-01-18 17:39:43 -05:00
commit cbd366d1a1
1 changed files with 9 additions and 1 deletions

View File

@ -780,6 +780,7 @@ function client.idx(c)
local c = c or capi.client.focus
if not c then return end
-- Only check the tiled clients, the others un irrelevant
local clients = client.tiled(c.screen)
local idx = nil
for k, cl in ipairs(clients) do
@ -791,6 +792,10 @@ function client.idx(c)
local t = tag.selected(c.screen)
local nmaster = tag.getnmaster(t)
-- This will happen for floating or maximized clients
if not idx then return nil end
if idx <= nmaster then
return {idx = idx, col=0, num=nmaster}
end
@ -834,9 +839,12 @@ function client.setwfact(wfact, c)
local c = c or capi.client.focus
if not c or not c:isvisible() then return end
local t = tag.selected(c.screen)
local w = client.idx(c)
if not w then return end
local t = tag.selected(c.screen)
local cls = client.tiled(tag.getscreen(t))
local nmaster = tag.getnmaster(t)