awesomewm-machina/tabs.lua

68 lines
2.0 KiB
Lua
Raw Normal View History

2021-07-03 23:50:31 +02:00
--------------------------------------------- widget.tabbar.default.lua -- ;
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful")
local bg_normal = beautiful.tabbar_bg_normal or beautiful.bg_normal or "#1a1a1a"
local fg_normal = beautiful.tabbar_fg_normal or beautiful.fg_normal or "#595959"
local bg_focus = beautiful.tabbar_bg_focus or beautiful.bg_focus or "#292929"
local bg_active = "#43417a"
-- local bg_active = "#394037"
local fg_focus = beautiful.tabbar_fg_focus or beautiful.fg_focus or "#ffffff"
local font = beautiful.tabbar_font or beautiful.font or "Recursive Sans Casual Static 8"
local size = beautiful.tabbar_size or 14
local position = beautiful.tabbar_position or "bottom"
local function create(c, focused_bool, buttons, idx)
local flexlist = wibox.layout.flex.horizontal
local title_temp = string.lower(c.class) or c.name or "-"
local bg_temp = bg_normal
local fg_temp = fg_normal
if focused_bool then
2021-07-05 04:11:56 +02:00
bg_temp = bg_focus
2021-07-03 23:50:31 +02:00
fg_temp = fg_focus
end
2021-07-05 04:11:56 +02:00
if client.focus == c and focused_bool then
bg_temp = bg_active
end --|when the client is maximized and then minimized, bg
--|color should be active
2021-07-03 23:50:31 +02:00
local text_temp = wibox.widget.textbox()
2021-07-05 02:44:09 +02:00
2021-07-03 23:50:31 +02:00
text_temp.align = "center"
text_temp.valign = "center"
text_temp.wrap = "word"
text_temp.font = font
text_temp.focused = false
text_temp.markup = "<span foreground='" .. fg_temp .. "'>" .. title_temp.. "</span>"
if focused_bool then text_temp.focused = true end
local wid_temp = wibox.widget({
2021-07-05 04:11:56 +02:00
id = c.window,
2021-07-03 23:50:31 +02:00
text_temp,
buttons = buttons,
bg = bg_temp,
2021-07-05 04:11:56 +02:00
focused = focused_bool,
2021-07-03 23:50:31 +02:00
widget = wibox.container.background()
})
return wid_temp
end
return {
layout = wibox.layout.flex.horizontal,
create = create,
create_focused = create_focused,
position = position,
size = size,
bg_normal = bg_normal,
bg_focus = bg_focus,
}