make tablist always visible

This commit is contained in:
Xinhao Yuan 2019-07-09 17:34:06 -04:00
parent 2f3d03fcc3
commit 21cad445ae
1 changed files with 21 additions and 15 deletions

View File

@ -78,7 +78,26 @@ local function start(c)
local traverse_x = c.x + traverse_radius local traverse_x = c.x + traverse_radius
local traverse_y = c.y + traverse_radius local traverse_y = c.y + traverse_radius
local function ensure_tablist()
if tablist == nil then
tablist = {}
for _, tc in ipairs(screen.tiled_clients) do
if tc.machi_region == c.machi_region
and not tc.maximized
and not tc.maximized_horizontal
and not tc.maximized_vertical
then
tablist[#tablist + 1] = tc
end
end
tablist_index = 1
end
end
local function draw_info(context, cr, width, height) local function draw_info(context, cr, width, height)
ensure_tablist()
cr:set_source_rgba(0, 0, 0, 0) cr:set_source_rgba(0, 0, 0, 0)
cr:rectangle(0, 0, width, height) cr:rectangle(0, 0, width, height)
cr:fill() cr:fill()
@ -88,7 +107,7 @@ local function start(c)
cr:rectangle(a.x - screen_x, a.y - screen_y, a.width, a.height) cr:rectangle(a.x - screen_x, a.y - screen_y, a.width, a.height)
cr:clip() cr:clip()
if i == c.machi_region and tablist ~= nil then if i == c.machi_region then
local pl = api.lgi.Pango.Layout.create(cr) local pl = api.lgi.Pango.Layout.create(cr)
pl:set_font_description(tablist_font_desc) pl:set_font_description(tablist_font_desc)
@ -156,20 +175,7 @@ local function start(c)
function (mod, key, event) function (mod, key, event)
if event == "release" then return end if event == "release" then return end
if key == "Tab" then if key == "Tab" then
if tablist == nil then ensure_tablist()
tablist = {}
for _, tc in ipairs(screen.tiled_clients) do
if tc.machi_region == c.machi_region
and not tc.maximized
and not tc.maximized_horizontal
and not tc.maximized_vertical
then
tablist[#tablist + 1] = tc
end
end
tablist_index = 1
end
if #tablist > 0 then if #tablist > 0 then
tablist_index = tablist_index % #tablist + 1 tablist_index = tablist_index % #tablist + 1