diff --git a/layout/mstab.lua b/layout/mstab.lua index b9f4bda..2616d27 100644 --- a/layout/mstab.lua +++ b/layout/mstab.lua @@ -8,19 +8,20 @@ local mylayout = {} mylayout.name = "mstab" -local tabbar_padding = beautiful.mstab_bar_padding or "default" -local tabbar_height = beautiful.mstab_bar_height or 40 -local border_radius = beautiful.mstab_border_radius or beautiful.border_radius or 0 -local tabbar_font = beautiful.mstab_font or beautiful.font or "Monospace 8" -local bg_focus = beautiful.mstab_bg_focus or beautiful.bg_focus or "#ff0000" -local bg_normal = beautiful.mstab_bg_normal or beautiful.bg_normal or "#000000" -local fg_focus = beautiful.mstab_fg_focus or beautiful.fg_focus or "#000000" -local fg_normal = beautiful.mstab_fg_normal or beautiful.fg_normal or "#ffffff" -local tabbar_orientation = "top" -if beautiful.mstab_tabbar_orientation == "bottom" then - tabbar_orientation = "bottom" -end +local tabbar_padding = beautiful.mstab_bar_padding or "default" +local tabbar_height = beautiful.mstab_bar_height or beautiful.tabbar_size or 40 +local border_radius = beautiful.mstab_border_radius or beautiful.border_radius or 0 +local tabbar_font = beautiful.mstab_font or beautiful.tabbar_font or beautiful.font or "Monospace 8" +local bg_focus = beautiful.mstab_bg_focus or beautiful.tabbar_bg_focus or beautiful.bg_focus or "#ff0000" +local bg_normal = beautiful.mstab_bg_normal or beautiful.tabbar_bg_normal or beautiful.bg_normal or "#000000" +local fg_focus = beautiful.mstab_fg_focus or beautiful.tabbar_fg_focus or beautiful.fg_focus or "#000000" +local fg_normal = beautiful.mstab_fg_normal or beautiful.tabbar_fg_normal or beautiful.fg_normal or "#ffffff" + +local tabbar_position = beautiful.mstab_tabbar_position or beautiful.tabbar_position or "top" + +local bar_style = beautiful.mstab_tabbar_style or beautiful.tabbar_style or "default" +local bar = require(tostring(...):match(".*bling") .. ".widget.tabbar." .. bar_style) -- The top_idx is the idx of the slave clients (excluding all master clients) -- that should be on top of all other slave clients ("the focused slave") @@ -45,29 +46,13 @@ function update_tabbar(clients, t, top_idx, area, master_area_width, slave_area_ local s = t.screen -- create the list of clients for the tabbar - local clientlist = wibox.layout.flex.horizontal() + local clientlist = bar.layout() for idx,c in ipairs(clients) do - local client_title = c.name or c.class or "" - local client_text = wibox.widget.textbox() - client_text.font = tabbar_font - client_text.align = "center" - client_text.valign = "center" - client_text.markup = "" .. client_title .. "" - local client_bg = bg_normal - if idx == top_idx then - client_bg = bg_focus - client_text.markup = "" .. client_title .. "" - end - local client_box = wibox.widget { - client_text, - bg = client_bg, - widget = wibox.container.background() - } -- focus with right click, kill with mid click, minimize with left click local buttons = gears.table.join(awful.button({}, 1, function() c:raise() client.focus = c end), awful.button({}, 2, function() c:kill() end), awful.button({}, 3, function() c.minimized = true end)) - client_box:buttons(buttons) + local client_box = bar.create(c, (idx==top_idx), buttons) clientlist:add(client_box) end @@ -99,7 +84,7 @@ function update_tabbar(clients, t, top_idx, area, master_area_width, slave_area_ s.tabbar.width = slave_area_width - 2*t.gap s.tabbar.height = tabbar_height - if tabbar_orientation == "bottom" then + if tabbar_position == "bottom" then s.tabbar.y = area.y + area.height - tabbar_height - t.gap end @@ -183,7 +168,7 @@ function mylayout.arrange(p) g.height = area.height - tabbar_height - tabbar_padding g.x = area.x + master_area_width g.y = area.y - if tabbar_orientation == "top" then + if tabbar_position == "top" then g.y = g.y + tabbar_height + tabbar_padding else g.y = g.y diff --git a/module/tabbed.lua b/module/tabbed.lua index 7211955..40e708e 100644 --- a/module/tabbed.lua +++ b/module/tabbed.lua @@ -17,8 +17,8 @@ local beautiful = require("beautiful") local helpers = require(tostring(...):match(".*bling.module") .. ".helpers") -local bar_style = beautiful.tabbed_tabbar_style or "default" -local bar = require(tostring(...):match(".*bling") .. ".widget.tabbed_tabbar." .. bar_style) +local bar_style = beautiful.tabbar_style or "default" +local bar = require(tostring(...):match(".*bling") .. ".widget.tabbar." .. bar_style) local function copy_size(c, parent_client) diff --git a/widget/tabbed_tabbar/default.lua b/widget/tabbar/default.lua similarity index 100% rename from widget/tabbed_tabbar/default.lua rename to widget/tabbar/default.lua