local P = {} P.__index = P function P:new(args) local s = { command = args.command, icon = args.icon } setmetatable(s, self) s.widget = wibox.widget { { { -- Right space widget = wibox.widget.separator, color = beautiful.color.transparent, forced_width = beautiful.dpi(3) }, { wibox.widget { resize = true, image = conf.app_icon_dir .. s.icon, widget = wibox.widget.imagebox }, top = beautiful.dpi(3), bottom = beautiful.dpi(3), layout = wibox.container.margin, }, { -- Left space widget = wibox.widget.separator, color = beautiful.color.transparent, forced_width = beautiful.dpi(3) }, layout = wibox.layout.align.horizontal, }, layout = wibox.container.background } s.widget:connect_signal("mouse::enter", function(result) result.bg = beautiful.color.bar.hover_bg end) s.widget:connect_signal("mouse::leave", function(result) result.bg = beautiful.color.transparent end) s.widget:connect_signal("button::press", function(_, _, _, button, mods) if (button == 1) then awful.spawn(s.command, false) end end ) return s end return P