aboutsummaryrefslogtreecommitdiff
path: root/plugins/smallclock.lua
blob: 201a65acdc55c6ec3e7960bda3dda6ca350c8105 (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
-- mod-version:3 --lite-xl 2.1
local core = require "core"
local style = require "core.style"
local StatusView = require "core.statusview"

local time = ""

local last_time = os.time()
local function update_time()
  if os.time() > last_time then
    local t = os.date("*t")
    time = string.format("%02d:%02d", t.hour, t.min)
    last_time = os.time()
  end
end

core.status_view:add_item(
  nil,
  "status:small-clock",
  StatusView.Item.RIGHT,
  function()
    update_time()
    return {style.accent, time}
  end,
  nil,
  -1
).separator = core.status_view.separator2