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 = args.position or "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 = (function() if (not args.position) or (args.position == "left") or (args.position == "right") then return style.unitybar_width or 50 end end)(), height = (function() if (args.position == "bottom") or (args.posiiton == "top") then return style.unitybar_width or 50 end end)() }) 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 = (function() if (s.myunitybar.position == "left") or (s.myunitybar.position == "right") then return wibox.layout.align.vertical else return wibox.layout.align.horizontal end end)(), top_widgets, { --Middle spacer widget = wibox.container.background }, bottom_widgets } } return s.myunitybar end return unitybar