diff options
author | Adam <adamdharrison@gmail.com> | 2021-08-16 19:20:24 -0230 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 19:20:24 -0230 |
commit | 3dd0d666ef9ae5a35661bfe1a5eef5d73981f75f (patch) | |
tree | 53ac997ed123d8a80aa0f5d1bf0b25c88260a3c7 /plugins/smallclock.lua | |
parent | 139d90dbc1640d26981e17983f439e9f11a06617 (diff) | |
parent | 38c70503fd7019834c6c30278e235622c451f000 (diff) | |
download | lite-xl-plugins-3dd0d666ef9ae5a35661bfe1a5eef5d73981f75f.tar.gz lite-xl-plugins-3dd0d666ef9ae5a35661bfe1a5eef5d73981f75f.zip |
Merge branch 'master' into language-toml
Diffstat (limited to 'plugins/smallclock.lua')
-rw-r--r-- | plugins/smallclock.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/smallclock.lua b/plugins/smallclock.lua new file mode 100644 index 0000000..5c76160 --- /dev/null +++ b/plugins/smallclock.lua @@ -0,0 +1,27 @@ +-- lite-xl 1.16 +local core = require "core" +local style = require "core.style" +local status_view = require "core.statusview" + +local time = "" + +core.add_thread(function() + while true do + local t = os.date("*t") + time = string.format("%02d:%02d", t.hour, t.min) + coroutine.yield(1) + end +end) + +local get_items = status_view.get_items + +function status_view:get_items() + local left, right = get_items(self) + local t = {style.dim, self.separator2, style.accent, time} + + for _, item in ipairs(t) do + table.insert(right, item) + end + + return left, right +end |