local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local awmtk = require("awmtk")
function unitybar(s,args)
    local style = awmtk.style(awmtk.defaults,args.style or {},"unitybar_")
    s.myunitybar = awful.wibar({
        position = "left", 
        screen = s,
        border_width = style.unitybar_border_width or 1,
        border_color = style.unitybar_border_color or "#262626AA",
        bg = style.unitybar_bg or (
            (type(style.bg_normal) == "string") and 
            (style.bg_normal:len() < 8) and 
        style.bg_normal.."AA"),
        width = style.unitybar_width or 50,
    })
    local top_widgets = {
        layout = wibox.layout.fixed.vertical,
    }
    local bottom_widgets = {
        layout = wibox.layout.fixed.vertical,
    }
    for _,widget in pairs(args.top_widgets or {}) do
        table.insert(top_widgets,widget)
    end
    for _, widget in pairs(args.bottom_widgets or {}) do
        table.insert(bottom_widgets,widget)
    end
    s.myunitybar:setup {
        widget = wibox.container.margin,
        margins = style.unitybar_inner_margin,
        {
            layout = wibox.layout.align.vertical,
            top_widgets,
            { --Middle spacer
                widget = wibox.container.background
            },
            bottom_widgets
        }
    }
    return s.myunitybar
end
return unitybar
