summaryrefslogtreecommitdiff
path: root/pkgs/astal/src/widget/bar/date.lua
blob: b64d8bbab0db7a86b17c41883e68e57db274f4c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local astal = require("astal")
local Widget = require("astal.gtk3.widget")
local Variable = astal.Variable
local GLib = astal.require("GLib")

local format = "%Y-%m-%d %a %H:%M:%S"
local date = Variable(""):poll(
	1000, function()
		return GLib.DateTime.new_now_local():format(format)
	end
);

return function()
	return Widget.Label({
		class_name = "date",
		label = date(),
	})
end