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