1
0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-11-23 12:27:50 +01:00

Add ability to disable the timer (#75)

This commit is contained in:
William 2022-09-09 19:04:11 -04:00 committed by GitHub
parent a3f7c42a4a
commit 03e09d3f9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

@ -44,6 +44,7 @@ require("presence"):setup({
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
show_time = true, -- Show the timer
-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
@ -70,6 +71,7 @@ let g:presence_enable_line_number = 0
let g:presence_blacklist = []
let g:presence_buttons = 1
let g:presence_file_assets = {}
let g:presence_show_time = 1
" Rich Presence text options
let g:presence_editing_text = "Editing %s"

@ -121,6 +121,7 @@ function Presence:setup(options)
self:set_option("line_number_text", "Line %s out of %s")
self:set_option("blacklist", {})
self:set_option("buttons", true)
self:set_option("show_time", true)
-- File assets options
self:set_option("file_assets", {})
for name, asset in pairs(default_file_assets) do
@ -820,9 +821,9 @@ function Presence:update_for_buffer(buffer, should_debounce)
local activity = {
state = status_text,
assets = assets,
timestamps = {
timestamps = self.options.show_time == 1 and {
start = relative_activity_set_at,
},
} or nil,
}
-- Add button that links to the git workspace remote origin url
@ -870,9 +871,9 @@ function Presence:update_for_buffer(buffer, should_debounce)
if self.workspaces[project_path] then
self.workspaces[project_path].updated_at = activity_set_at
activity.timestamps = {
activity.timestamps = self.options.show_time == 1 and {
start = self.workspaces[project_path].started_at,
}
} or nil
else
self.workspaces[project_path] = {
started_at = activity_set_at,