bling/widget/tabbar/pure.lua

82 lines
3.1 KiB
Lua
Raw Permalink Normal View History

2021-08-03 19:44:04 +02:00
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local gcolor = require("gears.color")
local beautiful = require("beautiful")
local bg_normal = beautiful.tabbar_bg_normal or beautiful.bg_normal or "#ffffff"
local fg_normal = beautiful.tabbar_fg_normal or beautiful.fg_normal or "#000000"
2021-08-27 20:01:22 +02:00
local bg_focus = beautiful.tabbar_bg_focus or beautiful.bg_focus or "#000000"
local fg_focus = beautiful.tabbar_fg_focus or beautiful.fg_focus or "#ffffff"
local bg_focus_inactive = beautiful.tabbar_bg_focus_inactive or bg_focus
local fg_focus_inactive = beautiful.tabbar_fg_focus_inactive or fg_focus
local bg_normal_inactive = beautiful.tabbar_bg_normal_inactive or bg_normal
local fg_normal_inactive = beautiful.tabbar_fg_normal_inactive or fg_normal
2021-08-27 20:01:22 +02:00
local font = beautiful.tabbar_font or beautiful.font or "Hack 15"
local size = beautiful.tabbar_size or 20
local position = beautiful.tabbar_position or "top"
2021-08-03 19:44:04 +02:00
local function create(c, focused_bool, buttons, inactive_bool)
local bg_temp = inactive_bool and bg_normal_inactive or bg_normal
local fg_temp = inactive_bool and fg_normal_inactive or fg_normal
if focused_bool then
bg_temp = inactive_bool and bg_focus_inactive or bg_focus
fg_temp = inactive_bool and fg_focus_inactive or fg_focus
end
2021-08-03 19:44:04 +02:00
local wid_temp = wibox.widget({
{
{ -- Left
2021-08-27 20:01:22 +02:00
wibox.widget.base.make_widget(
awful.titlebar.widget.iconwidget(c)
),
2021-08-03 19:44:04 +02:00
buttons = buttons,
2021-08-27 20:01:22 +02:00
layout = wibox.layout.fixed.horizontal,
2021-08-03 19:44:04 +02:00
},
{ -- Title
2021-08-27 20:01:22 +02:00
wibox.widget.base.make_widget(
awful.titlebar.widget.titlewidget(c)
),
2021-08-03 19:44:04 +02:00
buttons = buttons,
2021-08-27 20:01:22 +02:00
widget = wibox.container.place,
2021-08-03 19:44:04 +02:00
},
{ -- Right
2021-08-27 20:01:22 +02:00
focused_bool and wibox.widget.base.make_widget(
awful.titlebar.widget.floatingbutton(c)
) or nil,
focused_bool and wibox.widget.base.make_widget(
awful.titlebar.widget.stickybutton(c)
) or nil,
focused_bool and wibox.widget.base.make_widget(
awful.titlebar.widget.ontopbutton(c)
) or nil,
focused_bool and wibox.widget.base.make_widget(
awful.titlebar.widget.maximizedbutton(c)
) or nil,
focused_bool and wibox.widget.base.make_widget(
awful.titlebar.widget.minimizebutton(c)
) or nil,
focused_bool and wibox.widget.base.make_widget(
awful.titlebar.widget.closebutton(c)
) or nil,
2021-08-03 19:44:04 +02:00
layout = wibox.layout.fixed.horizontal,
},
layout = wibox.layout.align.horizontal,
},
2021-08-27 20:01:22 +02:00
bg = bg_temp,
fg = fg_temp,
widget = wibox.container.background,
2021-08-03 19:44:04 +02:00
})
return wid_temp
end
return {
2021-08-27 20:01:22 +02:00
layout = wibox.layout.flex.horizontal,
create = create,
position = position,
size = size,
2021-08-03 19:44:04 +02:00
bg_normal = bg_normal,
2021-08-27 20:01:22 +02:00
bg_focus = bg_focus,
2021-08-03 19:44:04 +02:00
}