This commit is contained in:
u80864958 2024-10-07 22:19:02 +02:00
parent d367d166a9
commit e9eab52653

View File

@ -132,6 +132,20 @@ local function log_time_table()
end end
end end
local function focus_gained()
table.insert(focus_events, {
time = os.time(),
event = "gain",
})
end
local function focus_lost()
table.insert(focus_events, {
time = os.time(),
event = "lose",
})
end
local function persist() local function persist()
local today = os.date("%y-%m-%d", os.time()) local today = os.date("%y-%m-%d", os.time())
@ -162,7 +176,7 @@ local function persist()
return return
end end
file:write("## dates and their corresponding seconds been here :)\n", TOML.encode(table), "\n") file:write("## dates and their corresponding seconds been here :)\n", TOML.encode(table), "\n")
file.close() file.close()
--reset timer --reset timer
@ -170,19 +184,6 @@ local function persist()
focus_events = {} focus_events = {}
focus_gained() focus_gained()
end end
local function focus_gained()
table.insert(focus_events, {
time = os.time(),
event = "gain",
})
end
local function focus_lost()
table.insert(focus_events, {
time = os.time(),
event = "lose",
})
end
local function setup() local function setup()
vim.api.nvim_create_autocmd("VimEnter", vim.api.nvim_create_autocmd("VimEnter",