2021-08-27 20:01:22 +02:00
|
|
|
local wibox = require("wibox")
|
|
|
|
local awful = require("awful")
|
|
|
|
local gears = require("gears")
|
|
|
|
local beautiful = require("beautiful")
|
2021-08-18 20:39:33 +02:00
|
|
|
local dpi = require("beautiful.xresources").apply_dpi
|
|
|
|
|
|
|
|
local function tabobj_support(self, c, index, clients)
|
2021-09-27 08:14:33 +02:00
|
|
|
-- Self is the background widget in this context
|
|
|
|
if not c.bling_tabbed and #c.bling_tabbed.clients > 1 then
|
|
|
|
return
|
|
|
|
end
|
2021-08-18 20:39:33 +02:00
|
|
|
|
2021-09-27 08:14:33 +02:00
|
|
|
local group = c.bling_tabbed
|
|
|
|
|
|
|
|
-- TODO: Allow customization here
|
|
|
|
local layout_v = wibox.widget {
|
|
|
|
vertical_spacing = dpi(2),
|
|
|
|
horizontal_spacing = dpi(2),
|
|
|
|
layout = wibox.layout.grid.horizontal,
|
|
|
|
forced_num_rows = 2,
|
|
|
|
forced_num_cols = 2,
|
|
|
|
homogeneous = true
|
|
|
|
}
|
2021-08-18 20:39:33 +02:00
|
|
|
|
2021-09-27 08:14:33 +02:00
|
|
|
local wrapper = wibox.widget({
|
|
|
|
layout_v,
|
|
|
|
id = "click_role",
|
|
|
|
widget = wibox.container.margin,
|
|
|
|
margins = dpi(5),
|
|
|
|
})
|
2021-08-18 20:39:33 +02:00
|
|
|
|
2021-09-27 08:14:33 +02:00
|
|
|
-- To get the ball rolling.
|
|
|
|
for idx, c in ipairs(group.clients) do
|
|
|
|
if not (c and c.icon) then goto skip end
|
2021-08-18 20:39:33 +02:00
|
|
|
|
2021-09-27 08:14:33 +02:00
|
|
|
-- Add to the last layout
|
|
|
|
layout_v:add(wibox.widget {
|
|
|
|
{
|
|
|
|
widget = awful.widget.clienticon,
|
|
|
|
client = c
|
|
|
|
},
|
|
|
|
widget = wibox.container.constraint,
|
|
|
|
width = dpi(24),
|
|
|
|
height = dpi(24)
|
|
|
|
})
|
|
|
|
::skip::
|
|
|
|
end
|
|
|
|
self.widget = wrapper
|
2021-08-18 20:39:33 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return tabobj_support
|