mirror of
https://github.com/jiriks74/presence.nvim
synced 2025-06-28 23:18:56 +02:00
Support peer-to-peer workspace state management
- Add sync logic to manage multi-client runtime state - Debounce and set activity on TextChanged events - Update timestamp to be workspace-specific - Set activity on an open nvim instance upon a VimLeave event
This commit is contained in:
parent
a2f6550177
commit
a325d154fc
5 changed files with 490 additions and 47 deletions
lua/presence
|
@ -149,13 +149,19 @@ function Discord:set_activity(activity, on_response)
|
|||
self:call(self.opcodes.frame, payload, on_response)
|
||||
end
|
||||
|
||||
function Discord.generate_uuid()
|
||||
function Discord.generate_uuid(seed)
|
||||
local index = 0
|
||||
local template ="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
|
||||
|
||||
local uuid = template:gsub("[xy]", function(char)
|
||||
-- Increment an index to seed per char
|
||||
index = index + 1
|
||||
math.randomseed((seed or os.clock()) / index)
|
||||
|
||||
local n = char == "x"
|
||||
and math.random(0, 0xf)
|
||||
or math.random(8, 0xb)
|
||||
|
||||
return string.format("%x", n)
|
||||
end)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue