add-create-callback to titlebar_indicator
This commit is contained in:
parent
7277f57730
commit
1f8c3bdcd7
|
@ -75,4 +75,16 @@ theme.task_preview_widget_border_color = "#ffffff" -- The border color of the
|
||||||
theme.task_preview_widget_border_width = 3 -- The border width of the widget
|
theme.task_preview_widget_border_width = 3 -- The border width of the widget
|
||||||
theme.task_preview_widget_margin = 0 -- The margin of the widget
|
theme.task_preview_widget_margin = 0 -- The margin of the widget
|
||||||
|
|
||||||
|
-- tabbed misc widget(s)
|
||||||
|
theme.bling_tabbed_misc_titlebar_indicator = {
|
||||||
|
layout_spacing = dpi(4),
|
||||||
|
icon_size = dpi(20),
|
||||||
|
icon_margin = dpi(4),
|
||||||
|
bg_color_focus = "#ff0000",
|
||||||
|
bg_color = "#00000000",
|
||||||
|
icon_shape = function(cr, w, h)
|
||||||
|
gears.shape.rounded_rect(cr, w, h, 0)
|
||||||
|
end,
|
||||||
|
layout = wibox.layout.fixed.horizontal
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -35,7 +35,12 @@ bling.widget.tabbed_misc.titlebar_indicator(client, {
|
||||||
},
|
},
|
||||||
widget = wibox.container.margin,
|
widget = wibox.container.margin,
|
||||||
margins = 2,
|
margins = 2,
|
||||||
id = 'click_role'
|
id = 'click_role',
|
||||||
|
update_callback = function(self, client, group)
|
||||||
|
if client == group.clients[group.focused_idx] then
|
||||||
|
self.margins = 5
|
||||||
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
|
@ -40,16 +40,11 @@ return function(c, opts)
|
||||||
spacing = opts.layout_spacing,
|
spacing = opts.layout_spacing,
|
||||||
})
|
})
|
||||||
|
|
||||||
awesome.connect_signal(
|
awesome.connect_signal("bling::tabbed::client_removed", function(_, removed_c)
|
||||||
"bling::tabbed::client_removed",
|
-- Remove from list
|
||||||
function(_, removed_c)
|
for idx, icon in ipairs(tabbed_icons.children) do
|
||||||
-- Remove from list
|
if icon._client == removed_c then
|
||||||
for idx, icon in ipairs(tabbed_icons.children) do
|
tabbed_icons:remove(idx)
|
||||||
if
|
|
||||||
icon:get_children_by_id("icon_role")[1].client == removed_c
|
|
||||||
then
|
|
||||||
tabbed_icons:remove(idx)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Empty list
|
-- Empty list
|
||||||
|
@ -57,7 +52,7 @@ return function(c, opts)
|
||||||
tabbed_icons:reset()
|
tabbed_icons:reset()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
end)
|
||||||
|
|
||||||
local function recreate(group)
|
local function recreate(group)
|
||||||
if tbl_contains(group.clients, c) then
|
if tbl_contains(group.clients, c) then
|
||||||
|
@ -93,6 +88,13 @@ return function(c, opts)
|
||||||
widget = wibox.container.place,
|
widget = wibox.container.place,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
widget._client = client
|
||||||
|
|
||||||
|
-- No creation call back since this would be called on creation & every time the widget updated.
|
||||||
|
if opts.widget_template.update_callback then
|
||||||
|
opts.widget_template.update_callback(widget, client, group)
|
||||||
|
end
|
||||||
|
|
||||||
-- Add icons & etc
|
-- Add icons & etc
|
||||||
for _, w in ipairs(widget:get_children_by_id("icon_role")) do
|
for _, w in ipairs(widget:get_children_by_id("icon_role")) do
|
||||||
-- TODO: Allow fallback icon?
|
-- TODO: Allow fallback icon?
|
||||||
|
|
Loading…
Reference in New Issue