tabbed: added a signal and a way to disable the titlebar (#79)

The signals allows for further customization on the user end such as integrating the tabbar into ones titlebar. The option to disable the titlebar was overdue.
This commit is contained in:
contribuewwt 2021-07-27 20:06:20 +05:30 committed by GitHub
parent f3239891bf
commit 039d48ee22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -29,6 +29,7 @@ theme.tabbar_bg_normal = "#000000" -- background color of the focused c
theme.tabbar_fg_normal = "#ffffff" -- foreground color of the focused client on the tabbar theme.tabbar_fg_normal = "#ffffff" -- foreground color of the focused client on the tabbar
theme.tabbar_bg_focus = "#1A2026" -- background color of unfocused clients on the tabbar theme.tabbar_bg_focus = "#1A2026" -- background color of unfocused clients on the tabbar
theme.tabbar_fg_focus = "#ff0000" -- foreground color of unfocused clients on the tabbar theme.tabbar_fg_focus = "#ff0000" -- foreground color of unfocused clients on the tabbar
theme.tabbar_disable = false -- disable the tab bar entirely
-- the following variables are currently only for the "modern" tabbar style -- the following variables are currently only for the "modern" tabbar style
theme.tabbar_color_close = "#f9929b" -- chnges the color of the close button theme.tabbar_color_close = "#f9929b" -- chnges the color of the close button
@ -43,3 +44,10 @@ Modern theme:
<img src="https://imgur.com/omowmIQ.png" width="600"/> <img src="https://imgur.com/omowmIQ.png" width="600"/>
*screenshot by [javacafe](https://github.com/JavaCafe01)* *screenshot by [javacafe](https://github.com/JavaCafe01)*
### Signals
The tabbed module emits 1 signals for the purpose of integrating with your rice,
```lua
-- bling::tabbed::update -- triggered whenever a tabbed object is updated
-- tabobj -- the object that caused the update
```

View File

@ -37,7 +37,9 @@ tabbed.remove = function(c)
if not c or not c.bling_tabbed then return end if not c or not c.bling_tabbed then return end
local tabobj = c.bling_tabbed local tabobj = c.bling_tabbed
table.remove(tabobj.clients, tabobj.focused_idx) table.remove(tabobj.clients, tabobj.focused_idx)
awful.titlebar.hide(c, bar.position) if not beautiful.tabbar_disable then
awful.titlebar.hide(c, bar.position)
end
c.bling_tabbed = nil c.bling_tabbed = nil
tabbed.switch_to(tabobj, 1) tabbed.switch_to(tabobj, 1)
end end
@ -60,6 +62,7 @@ tabbed.add = function(c, tabobj)
-- but the new client needs to have the tabobj property -- but the new client needs to have the tabobj property
-- before a clean switch can happen -- before a clean switch can happen
tabbed.update(tabobj) tabbed.update(tabobj)
awesome.emit_signal("bling::tabbed::client_added", tabobj)
tabbed.switch_to(tabobj, #tabobj.clients) tabbed.switch_to(tabobj, #tabobj.clients)
end end
@ -138,10 +141,13 @@ tabbed.update = function(tabobj)
end end
end end
tabbed.update_tabbar(tabobj) awesome.emit_signal("bling::tabbed::update", tabobj)
if not beautiful.tabbar_disable then
tabbed.update_tabbar(tabobj)
end
end end
-- change docused tab by absolute index -- change focused tab by absolute index
tabbed.switch_to = function(tabobj, new_idx) tabbed.switch_to = function(tabobj, new_idx)
local old_focused_c = tabobj.clients[tabobj.focused_idx] local old_focused_c = tabobj.clients[tabobj.focused_idx]
tabobj.focused_idx = new_idx tabobj.focused_idx = new_idx