focusable

This commit is contained in:
anakha 2021-07-04 22:11:56 -04:00
parent ad27f4a46f
commit e7ad4b1780
2 changed files with 63 additions and 4 deletions

View File

@ -750,6 +750,47 @@ end
-------------------------------------------------------- draw_tabbar() -- ;
local widget_ix = {}
-- client.connect_signal("property::name", function (c)
-- -- todo: need to update the other clients in the region here as well
-- this may not even be worth it as the client names kind of pollute the
-- tabs a lot making it harder to distinguish what is what.
-- if widget_ix[c.window] then
-- for i, p in pairs(widget_ix[c.window]) do
-- if p.focused then
-- widget = widget_ix[c.window][i]:get_children_by_id(c.window)[1]
-- -- naughty.notify({preset = naughty.config.presets.critical, text=inspect(widget)})
-- widget.widget.markup = c.name
-- end
-- end
-- end
-- end)
client.connect_signal("focus", function (c)
if widget_ix[c.window] then
for i, p in pairs(widget_ix[c.window]) do
if p.focused then
widget = widget_ix[c.window][i]:get_children_by_id(c.window)[1]
widget.bg = "#43417a"
end
end
end
end)
client.connect_signal("unfocus", function (c)
if widget_ix[c.window] then
for i, p in pairs(widget_ix[c.window]) do
if p.focused then
widget = widget_ix[c.window][i]:get_children_by_id(c.window)[1]
widget.bg = "#292929"
end
end
end
end)
function draw_tabbar(region_ix)
local flexlist = tabs.layout()
local tablist = get_tiled_clients(region_ix)
@ -766,11 +807,14 @@ function draw_tabbar(region_ix)
for c_ix, c in ipairs(tablist) do
local flexlist = tabs.layout()
widget_ix[c.window] = {}
for cc_ix, cc in ipairs(tablist) do
local buttons = gears.table.join(awful.button({}, 1, function() end))
wid_temp = tabs.create(cc, (cc == c), buttons, c_ix)
flexlist:add(wid_temp)
-- wid_temp
widget_ix[c.window][cc_ix] = tabs.create(cc, (cc == c), buttons, c_ix)
flexlist:add(widget_ix[c.window][cc_ix])
flexlist.max_widget_size = 120
end
@ -882,6 +926,15 @@ client.connect_signal("property::floating", floating_signal)
client.connect_signal("tabbar_draw", draw_tabbar)
--[[+] experimental signalling ]]
-- client:connect_signal("property::name", function(c)
-- if widget_ix[c.window] then
-- local widget = widget_ix[c.window]:get_children_by_id(c.window)
-- text_temp.markup = "<span foreground='" .. fg_temp .. "'>" .. title_temp.. "</span>"
-- end
-- end)
client.connect_signal("unmanage", unmanage_signal)
--[[+]
when removing a tiled client we must update the tabbars

View File

@ -25,10 +25,15 @@ local function create(c, focused_bool, buttons, idx)
local fg_temp = fg_normal
if focused_bool then
bg_temp = bg_active
bg_temp = bg_focus
fg_temp = fg_focus
end
if client.focus == c and focused_bool then
bg_temp = bg_active
end --|when the client is maximized and then minimized, bg
--|color should be active
local text_temp = wibox.widget.textbox()
text_temp.align = "center"
@ -41,10 +46,11 @@ local function create(c, focused_bool, buttons, idx)
if focused_bool then text_temp.focused = true end
local wid_temp = wibox.widget({
id = c.window..idx,
id = c.window,
text_temp,
buttons = buttons,
bg = bg_temp,
focused = focused_bool,
widget = wibox.container.background()
})