add more options to titlebar indicator
This commit is contained in:
parent
7261f0ba40
commit
a525299d4f
|
@ -16,9 +16,12 @@ To use the task list indicator:
|
|||
|
||||
```lua
|
||||
bling.widget.tabbed_misc.titlebar_indicator(client, {
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
layout_spacing = dpi(5), -- Set spacing in between items
|
||||
icon_size = dpi(24),
|
||||
icon_margin = 0,
|
||||
fg_color = "#cccccc", -- Normal color for text
|
||||
fg_color_focus = "#ffffff", -- Color for focused text
|
||||
bg_color_focus = "#282828", -- Color for the focused items
|
||||
bg_color = "#1d2021", -- Color for normal / unfocused items
|
||||
icon_shape = gears.shape.circle -- Set icon shape,
|
||||
|
@ -35,7 +38,7 @@ bling.widget.tabbed_misc.titlebar_indicator(client, {
|
|||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = 2,
|
||||
id = 'click_role',
|
||||
id = 'bg_role',
|
||||
update_callback = function(self, client, group)
|
||||
if client == group.clients[group.focused_idx] then
|
||||
self.margins = 5
|
||||
|
|
|
@ -26,9 +26,12 @@ return function(c, opts)
|
|||
icon_margin = dpi(4),
|
||||
bg_color_focus = "#ff0000",
|
||||
bg_color = "#00000000",
|
||||
fg_color = "#fafafa",
|
||||
fg_color_focus = "#e0e0e0",
|
||||
icon_shape = function(cr, w, h)
|
||||
gears.shape.rounded_rect(cr, w, h, 0)
|
||||
end,
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
}, gears.table.join(
|
||||
opts,
|
||||
beautiful.bling_tabbed_misc_titlebar_indicator
|
||||
|
@ -36,7 +39,7 @@ return function(c, opts)
|
|||
|
||||
-- Container to store icons
|
||||
local tabbed_icons = wibox.widget({
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
layout = opts.layout,
|
||||
spacing = opts.layout_spacing,
|
||||
})
|
||||
|
||||
|
@ -46,79 +49,14 @@ return function(c, opts)
|
|||
if icon._client == removed_c then
|
||||
tabbed_icons:remove(idx)
|
||||
end
|
||||
end
|
||||
|
||||
-- Empty list
|
||||
if removed_c == c then
|
||||
tabbed_icons:reset()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
<<<<<<< HEAD
|
||||
local function recreate(group)
|
||||
if tbl_contains(group.clients, c) then
|
||||
tabbed_icons:reset()
|
||||
local focused = group.clients[group.focused_idx]
|
||||
|
||||
-- Autohide?
|
||||
if #group.clients == 1 then
|
||||
return
|
||||
end
|
||||
|
||||
for idx, client in ipairs(group.clients) do
|
||||
local widget = wibox.widget(opts.widget_template or {
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon_role",
|
||||
forced_width = opts.icon_size,
|
||||
forced_height = opts.icon_size,
|
||||
widget = awful.widget.clienticon,
|
||||
},
|
||||
margins = opts.icon_margin,
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
bg = (client == focused) and opts.bg_color_focus
|
||||
or opts.bg_color,
|
||||
shape = opts.icon_shape,
|
||||
id = "click_role",
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
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
|
||||
for _, w in ipairs(widget:get_children_by_id("icon_role")) do
|
||||
-- TODO: Allow fallback icon?
|
||||
w.image = client.icon
|
||||
w.client = client
|
||||
end
|
||||
|
||||
for _, w in ipairs(widget:get_children_by_id("click_role")) do
|
||||
w:add_button(awful.button({}, 1, function()
|
||||
tabbed_module.switch_to(group, idx)
|
||||
end))
|
||||
end
|
||||
|
||||
tabbed_icons:add(widget)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
awesome.connect_signal("bling::tabbed::client_added", recreate)
|
||||
awesome.connect_signal("bling::tabbed::changed_focus", recreate)
|
||||
|
||||
return tabbed_icons
|
||||
=======
|
||||
local function recreate(group)
|
||||
if tbl_contains(group.clients, c) then
|
||||
tabbed_icons:reset()
|
||||
|
@ -144,7 +82,7 @@ return function(c, opts)
|
|||
widget = wibox.container.margin,
|
||||
},
|
||||
shape = opts.icon_shape,
|
||||
id = "bg_role",
|
||||
id = "background_role",
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
halign = "center",
|
||||
|
@ -192,5 +130,4 @@ return function(c, opts)
|
|||
awesome.connect_signal("bling::tabbed::changed_focus", recreate)
|
||||
|
||||
return tabbed_icons
|
||||
>>>>>>> 848ddd9 (Use grid layout in custom_tasklist)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue