awesomewm/modules/launcher/widget.lua

49 lines
1.0 KiB
Lua

local launcher = req_rel(..., "util")
local widget = {}
widget.icon = wibox.widget {
resize = true,
image = beautiful.icons.launcher,
widget = wibox.widget.imagebox
}
widget.widget = wibox.widget {
{
{ -- Right space
widget = wibox.widget.separator,
color = beautiful.color.transparent,
forced_width = beautiful.dpi(3)
},
{
widget.icon,
top = beautiful.dpi(2),
bottom = beautiful.dpi(2),
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,
}
widget.widget:connect_signal("mouse::enter", function(result)
widget.widget.bg = beautiful.color.bar.hover_bg
end)
widget.widget:connect_signal("mouse::leave", function(result)
widget.widget.bg = beautiful.color.transparent
end)
widget.widget:connect_signal("button::press",
function(_, _, _, button, mods)
if (button == 1) then
launcher.launcher()
end
end
)
return widget