2022-07-16 17:18:27 -07:00
|
|
|
local function make_shortcut(command, icon)
|
2022-07-16 17:10:17 -07:00
|
|
|
local widget = wibox.widget {
|
2021-08-01 07:24:26 -07:00
|
|
|
{
|
|
|
|
{ -- Right space
|
|
|
|
widget = wibox.widget.separator,
|
|
|
|
color = beautiful.color.transparent,
|
|
|
|
forced_width = beautiful.dpi(3)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
wibox.widget {
|
|
|
|
resize = true,
|
2022-07-16 19:06:55 -07:00
|
|
|
image = config.core.app_icon_dir .. icon,
|
2021-08-01 07:24:26 -07:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
widget:connect_signal("mouse::enter", function(result)
|
|
|
|
result.bg = beautiful.color.bar.hover_bg
|
|
|
|
end)
|
|
|
|
|
|
|
|
widget:connect_signal("mouse::leave", function(result)
|
|
|
|
result.bg = beautiful.color.transparent
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
widget:connect_signal("button::press",
|
|
|
|
function(_, _, _, button, mods)
|
|
|
|
if (button == 1) then
|
|
|
|
awful.spawn(command, false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|
|
|
|
return widget
|
|
|
|
end
|
|
|
|
|
2022-07-16 17:18:27 -07:00
|
|
|
return make_shortcut
|