awful.menu: add a close function and fix various bugs
This commit is contained in:
parent
c8a461686a
commit
a2f3790dce
|
@ -180,7 +180,7 @@ function clients(menu)
|
||||||
local cls = capi.client.get()
|
local cls = capi.client.get()
|
||||||
local cls_t = {}
|
local cls_t = {}
|
||||||
for k, c in pairs(cls) do
|
for k, c in pairs(cls) do
|
||||||
cls_t[#cls_t + 1] = { util.escape(c.name),
|
cls_t[#cls_t + 1] = { util.escape(c.name) or "",
|
||||||
function ()
|
function ()
|
||||||
if not c:isvisible() then
|
if not c:isvisible() then
|
||||||
tags.viewmore(c:tags(), c.screen)
|
tags.viewmore(c:tags(), c.screen)
|
||||||
|
@ -211,7 +211,7 @@ local function set_coords(data)
|
||||||
data.w = data.parent.w
|
data.w = data.parent.w
|
||||||
data.h = data.parent.h
|
data.h = data.parent.h
|
||||||
|
|
||||||
local p_w = data.h*(data.num - 1)
|
local p_w = (data.h + data.theme.border_width) * (data.num - 1)
|
||||||
local m_h = data.theme.border_width + (data.h + data.theme.border_width)*data.nb_items
|
local m_h = data.theme.border_width + (data.h + data.theme.border_width)*data.nb_items
|
||||||
local m_w = data.w + data.theme.border_width
|
local m_w = data.w + data.theme.border_width
|
||||||
data.y = data.parent.y + p_w + m_h > screen_h and screen_h - m_h or data.parent.y + p_w
|
data.y = data.parent.y + p_w + m_h > screen_h and screen_h - m_h or data.parent.y + p_w
|
||||||
|
@ -262,3 +262,9 @@ function new(menu, parent, num)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Close a menu popup.
|
||||||
|
-- @param id The name of the menu to close
|
||||||
|
function close(id)
|
||||||
|
destroy(menus[id])
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue