Add awful.client.restore()

This restores the first minimized client it finds on the selected tags.

Optionally, this function accepts a screen number as its first argument.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-02-19 21:44:30 +01:00
parent 64bb0bea08
commit 2963a32d44
1 changed files with 22 additions and 0 deletions

View File

@ -640,6 +640,28 @@ function floating.delete(c)
floating.set(c, nil) floating.set(c, nil)
end end
--- Restore (=unminimize) a random client.
-- @param s The screen to use.
-- @return True if some client was restored.
function restore(s)
local s = s or (capi.client.focus and capi.client.focus.screen) or mouse.screen
local cls = capi.client.get(s)
local tags = tag.selectedlist(s)
local mcls = {}
for k, c in pairs(cls) do
local ctags = c:tags()
if c.minimized then
for k, t in ipairs(tags) do
if util.table.hasitem(ctags, t) then
c.minimized = false
return true
end
end
end
end
return false
end
-- Normalize a set of numbers to 1 -- Normalize a set of numbers to 1
-- @param set the set of numbers to normalize -- @param set the set of numbers to normalize
-- @param num the number of numbers to normalize -- @param num the number of numbers to normalize