diff --git a/README.md b/README.md index 55a0036..74ef06d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Use the Pomodoro Technique in Neovim with built-in session tracking and break re opts = function(_, opts) table.insert(opts.sections.lualine_x, 3, { function() - return require("pomodoro").get_pomodoro_status() + return require("pomodoro").get_pomodoro_status("🍅❌","🍅","☕") end, }) end, diff --git a/lua/pomodoro/pomodoro.lua b/lua/pomodoro/pomodoro.lua index 7766e81..402539d 100644 --- a/lua/pomodoro/pomodoro.lua +++ b/lua/pomodoro/pomodoro.lua @@ -43,18 +43,38 @@ function pomodoro.startTimer(time, fn) pomodoro.timer:start(time, 0, fn) end -function pomodoro.get_pomodoro_status() +---@param not_running_phase? string +---@param running_phase? string +---@param break_phase? string +---@return string +function pomodoro.get_pomodoro_status( + not_running_phase, + running_phase, + break_phase +) local time_left = pomodoro.timer_duration - (uv.now() - pomodoro.started_timer_time) local phase_str = "" if pomodoro.phase == Phases.NOT_RUNNING then - phase_str = "🍅❌" + if not_running_phase then + phase_str = not_running_phase + else + phase_str = "🍅❌" + end time_left = 0 elseif pomodoro.phase == Phases.RUNNING then - phase_str = "🍅" + if running_phase then + phase_str = running_phase + else + phase_str = "🍅" + end elseif pomodoro.phase == Phases.BREAK then - phase_str = "☕" + if break_phase then + phase_str = break_phase + else + phase_str = "☕" + end end local minutes = math.floor(time_left / 60000)