diff options
Diffstat (limited to 'pkgs/astal/src/widget/bar/date.lua')
-rw-r--r-- | pkgs/astal/src/widget/bar/date.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkgs/astal/src/widget/bar/date.lua b/pkgs/astal/src/widget/bar/date.lua new file mode 100644 index 0000000..b64d8bb --- /dev/null +++ b/pkgs/astal/src/widget/bar/date.lua @@ -0,0 +1,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 |