Skip to content

Commit 03e09d3

Browse files
authored
Add ability to disable the timer (andweeb#75)
1 parent a3f7c42 commit 03e09d3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ require("presence"):setup({
4444
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
4545
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)
4646
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
47+
show_time = true, -- Show the timer
4748

4849
-- Rich Presence text options
4950
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
7071
let g:presence_blacklist = []
7172
let g:presence_buttons = 1
7273
let g:presence_file_assets = {}
74+
let g:presence_show_time = 1
7375
7476
" Rich Presence text options
7577
let g:presence_editing_text = "Editing %s"

lua/presence/init.lua

+5-4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ function Presence:setup(options)
121121
self:set_option("line_number_text", "Line %s out of %s")
122122
self:set_option("blacklist", {})
123123
self:set_option("buttons", true)
124+
self:set_option("show_time", true)
124125
-- File assets options
125126
self:set_option("file_assets", {})
126127
for name, asset in pairs(default_file_assets) do
@@ -820,9 +821,9 @@ function Presence:update_for_buffer(buffer, should_debounce)
820821
local activity = {
821822
state = status_text,
822823
assets = assets,
823-
timestamps = {
824+
timestamps = self.options.show_time == 1 and {
824825
start = relative_activity_set_at,
825-
},
826+
} or nil,
826827
}
827828

828829
-- Add button that links to the git workspace remote origin url
@@ -870,9 +871,9 @@ function Presence:update_for_buffer(buffer, should_debounce)
870871

871872
if self.workspaces[project_path] then
872873
self.workspaces[project_path].updated_at = activity_set_at
873-
activity.timestamps = {
874+
activity.timestamps = self.options.show_time == 1 and {
874875
start = self.workspaces[project_path].started_at,
875-
}
876+
} or nil
876877
else
877878
self.workspaces[project_path] = {
878879
started_at = activity_set_at,

0 commit comments

Comments
 (0)