Skip to content

Commit

Permalink
fix(manager): fixed timestamp logic
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Jan 9, 2025
1 parent 4cb5a01 commit fabd09f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lua/cord/plugin/activity/manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ end
---Update the activity
---@return nil
function ActivityManager:update_activity()
if self:should_update_time() then self.opts.timestamp = os.time() end

self.is_idle = false
self.is_force_idle = false
self.last_opts = self.opts
Expand Down Expand Up @@ -498,7 +496,14 @@ function ActivityManager:build_opts()
is_focused = self.is_focused,
is_idle = self.is_idle,
}
if self.config.timestamp.enabled then opts.timestamp = os.time() end
if self.config.timestamp.enabled then
if self.last_opts and self.last_opts.timestamp then
opts.timestamp = self.last_opts.timestamp
else
opts.timestamp = os.time()
end
end
if self:should_update_time() then opts.timestamp = os.time() end
local buttons = config_utils:get_buttons(opts)
opts.buttons = buttons

Expand Down

0 comments on commit fabd09f

Please sign in to comment.