aboutsummaryrefslogtreecommitdiff
path: root/plugins/smallclock.lua
blob: 3ab9e4a6f53590c638e87006f574ba7496c48aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- lite-xl 2.00
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