Skip to content

Commit 0c11df8

Browse files
committed
allow modifying pomodoro status
1 parent 36cb077 commit 0c11df8

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Use the Pomodoro Technique in Neovim with built-in session tracking and break re
3232
opts = function(_, opts)
3333
table.insert(opts.sections.lualine_x, 3, {
3434
function()
35-
return require("pomodoro").get_pomodoro_status()
35+
return require("pomodoro").get_pomodoro_status("🍅❌","🍅","")
3636
end,
3737
})
3838
end,

lua/pomodoro/pomodoro.lua

+24-4
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,38 @@ function pomodoro.startTimer(time, fn)
4343
pomodoro.timer:start(time, 0, fn)
4444
end
4545

46-
function pomodoro.get_pomodoro_status()
46+
---@param not_running_phase? string
47+
---@param running_phase? string
48+
---@param break_phase? string
49+
---@return string
50+
function pomodoro.get_pomodoro_status(
51+
not_running_phase,
52+
running_phase,
53+
break_phase
54+
)
4755
local time_left = pomodoro.timer_duration
4856
- (uv.now() - pomodoro.started_timer_time)
4957

5058
local phase_str = ""
5159
if pomodoro.phase == Phases.NOT_RUNNING then
52-
phase_str = "🍅❌"
60+
if not_running_phase then
61+
phase_str = not_running_phase
62+
else
63+
phase_str = "🍅❌"
64+
end
5365
time_left = 0
5466
elseif pomodoro.phase == Phases.RUNNING then
55-
phase_str = "🍅"
67+
if running_phase then
68+
phase_str = running_phase
69+
else
70+
phase_str = "🍅"
71+
end
5672
elseif pomodoro.phase == Phases.BREAK then
57-
phase_str = ""
73+
if break_phase then
74+
phase_str = break_phase
75+
else
76+
phase_str = ""
77+
end
5878
end
5979

6080
local minutes = math.floor(time_left / 60000)

0 commit comments

Comments
 (0)