awesomewm/modules/simple_widgets/textclock.lua

47 lines
1.1 KiB
Lua
Raw Normal View History

2021-08-01 07:24:26 -07:00
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)
2022-07-16 17:18:27 -07:00
return textclock