File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,26 @@ function pomodoro.startTimer(time, fn)
43
43
pomodoro .timer :start (time , 0 , fn )
44
44
end
45
45
46
+ function pomodoro .get_pomodoro_status ()
47
+ local time_left = pomodoro .timer_duration
48
+ - (uv .now () - pomodoro .started_timer_time )
49
+
50
+ local phase_str = " "
51
+ if pomodoro .phase == Phases .NOT_RUNNING then
52
+ phase_str = " Not Running"
53
+ elseif pomodoro .phase == Phases .RUNNING then
54
+ phase_str = " Work"
55
+ elseif pomodoro .phase == Phases .BREAK then
56
+ phase_str = " Break"
57
+ end
58
+
59
+ local minutes = math.floor (time_left / 60000 )
60
+ local seconds = math.floor ((time_left % 60000 ) / 1000 )
61
+ local time_left_str = string.format (" %02d:%02d" , minutes , seconds )
62
+
63
+ return phase_str .. " " .. time_left_str
64
+ end
65
+
46
66
function pomodoro .displayPomodoroUI ()
47
67
if pomodoro .phase == Phases .NOT_RUNNING or pomodoro .phase == nil then
48
68
pomodoro .start ()
You can’t perform that action at this time.
0 commit comments