bling/docs/widgets/tabbed_misc.md

118 lines
3.4 KiB
Markdown
Raw Normal View History

## 🧱 Tabbed Miscellaneous <!-- {docsify-ignore} -->
This comprises a few widgets to better represent tabbed groups (from the tabbed module) in your desktop.
The widgets currently included are:
- Titlebar Indicator
- Tasklist
![Preview Image](https://i.imgur.com/ZeYSrxY.png)
## Titlebar Indicator
### Usage
To use the task list indicator:
**NOTE:** Options can be set as theme vars under the table `theme.bling_tabbed_misc_titlebar_indicator`
```lua
bling.widget.tabbed_misc.titlebar_indicator(client, {
2021-08-30 20:23:44 +02:00
layout = wibox.layout.fixed.vertical,
2021-08-19 08:01:31 +02:00
layout_spacing = dpi(5), -- Set spacing in between items
2021-11-15 14:05:30 +01:00
icon_size = dpi(24), -- Set icon size
icon_margin = 0, -- Set icon margin
2021-08-30 20:23:44 +02:00
fg_color = "#cccccc", -- Normal color for text
fg_color_focus = "#ffffff", -- Color for focused text
2021-08-19 08:01:31 +02:00
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,
})
```
a widget_template option is also available:
```lua
bling.widget.tabbed_misc.titlebar_indicator(client, {
2021-08-19 08:01:31 +02:00
widget_template = {
{
widget = awful.widget.clienticon,
id = 'icon_role'
},
widget = wibox.container.margin,
margins = 2,
2021-08-30 20:23:44 +02:00
id = 'bg_role',
update_callback = function(self, client, group)
if client == group.clients[group.focused_idx] then
self.margins = 5
end
end
2021-08-19 08:01:31 +02:00
}
})
```
### Example Implementation
You normally embed the widget in your titlebar...
```lua
awful.titlebar(c).widget = {
2021-08-19 08:01:31 +02:00
{ -- Left
bling.widget.tabbed_misc.titlebar_indicator(c),
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal
},
layout = wibox.layout.align.horizontal
}
```
## Tasklist
2021-08-19 08:01:31 +02:00
The module exports a function that can be added to your tasklist as a `update_callback`
### Usage
```lua
2021-08-19 08:01:31 +02:00
awful.widget.tasklist({
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
layout = {
spacing = dpi(10),
layout = wibox.layout.fixed.vertical,
},
style = {
bg_normal = "#00000000",
},
widget_template = {
{
{
widget = wibox.widget.imagebox,
id = "icon_role",
align = "center",
valign = "center",
},
width = dpi(24),
height = dpi(24),
widget = wibox.container.constraint,
},
widget = wibox.container.background, -- IT MUST BE A CONTAINER WIDGET AS THAT IS WHAT THE FUNCTION EXPECTS
update_callback = require("bling.widget.tabbed_misc").custom_tasklist,
id = "background_role",
},
})
```
2021-08-19 08:01:31 +02:00
If you need to do something else, it can be used like so
```lua
2021-08-19 08:01:31 +02:00
update_callback = function(self, client, index, clients)
require("bling.widget.tabbed_misc").custom_tasklist(self, client, index, clients)
require("naughty").notify({ text = "Tasklist was updated" })
end
```