From 039d48ee22b8eba94b983d05b31432350161dcf0 Mon Sep 17 00:00:00 2001 From: contribuewwt <38278035+undefinedDarkness@users.noreply.github.com> Date: Tue, 27 Jul 2021 20:06:20 +0530 Subject: [PATCH] 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. --- docs/module/tabbed.md | 8 ++++++++ module/tabbed.lua | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/module/tabbed.md b/docs/module/tabbed.md index e8547cb..590b153 100644 --- a/docs/module/tabbed.md +++ b/docs/module/tabbed.md @@ -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_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_disable = false -- disable the tab bar entirely -- the following variables are currently only for the "modern" tabbar style theme.tabbar_color_close = "#f9929b" -- chnges the color of the close button @@ -43,3 +44,10 @@ Modern theme: *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 +``` diff --git a/module/tabbed.lua b/module/tabbed.lua index 2d7a68e..90867f0 100644 --- a/module/tabbed.lua +++ b/module/tabbed.lua @@ -37,7 +37,9 @@ tabbed.remove = function(c) if not c or not c.bling_tabbed then return end local tabobj = c.bling_tabbed 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 tabbed.switch_to(tabobj, 1) end @@ -60,6 +62,7 @@ tabbed.add = function(c, tabobj) -- but the new client needs to have the tabobj property -- before a clean switch can happen tabbed.update(tabobj) + awesome.emit_signal("bling::tabbed::client_added", tabobj) tabbed.switch_to(tabobj, #tabobj.clients) end @@ -138,10 +141,13 @@ tabbed.update = function(tabobj) 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 --- change docused tab by absolute index +-- change focused tab by absolute index tabbed.switch_to = function(tabobj, new_idx) local old_focused_c = tabobj.clients[tabobj.focused_idx] tabobj.focused_idx = new_idx