aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAayush Kashyap <kashyapaayush32@gmail.com>2021-07-02 14:17:39 +0530
committerAayush Kashyap <kashyapaayush32@gmail.com>2021-07-02 14:17:39 +0530
commit99a80e97cce08620230cc11a41321d78ac6f8743 (patch)
tree22ea144144663b6daaaf9fadb2c35db02e48e958 /plugins
parent9596fd84f4ac718a97e2d9369ba3d093f1ea1bc8 (diff)
downloadlite-xl-plugins-99a80e97cce08620230cc11a41321d78ac6f8743.tar.gz
lite-xl-plugins-99a80e97cce08620230cc11a41321d78ac6f8743.zip
added smallclock plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/smallclock.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/smallclock.lua b/plugins/smallclock.lua
new file mode 100644
index 0000000..8742b07
--- /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()
+ 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