awesomewm/desktop/widgets/textclock.lua

50 lines
1.1 KiB
Lua
Executable File

local textclock = {}
textclock.widget = wibox.widget {
{
{ -- Right spacer
widget = wibox.widget.separator,
color = beautiful.color.transparent,
forced_width = beautiful.dpi(3)
},
wibox.widget {
wibox.widget.textclock("%m/%d"),
wibox.widget.textclock("%I:%M", 60),
-- Long format:
-- wibox.widget.textclock("%m/%d/%y"),
-- wibox.widget.textclock("%I:%M:%S", 1),
-- %H - 24-hour time
-- %I - 12-hour time
forced_num_cols = 1,
forced_num_rows = 2,
homogeneous = true,
expand = true,
layout = wibox.layout.grid
},
{ -- Left spacer
widget = wibox.widget.separator,
color = beautiful.color.transparent,
forced_width = beautiful.dpi(3)
},
layout = wibox.layout.align.horizontal,
},
layout = wibox.container.background,
}
-- Change background when mouse is over widget
textclock.widget:connect_signal("mouse::enter", function(result)
textclock.widget.bg = beautiful.color.bar.hover_bg
end)
textclock.widget:connect_signal("mouse::leave", function(result)
textclock.widget.bg = beautiful.color.transparent
end)
return textclock.widget