about summary refs log tree commit diff stats
path: root/031merge.cc
Commit message (Expand)AuthorAgeFilesLines
* 5001 - drop the :(scenario) DSLKartik Agaram2019-03-121-70/+113
* 4987 - support `browse_trace` tool in SubXKartik Agaram2019-02-251-3/+3
* 4264Kartik Agaram2018-06-171-0/+227
* 4259Kartik Agaram2018-06-161-227/+0
* 4104Kartik K. Agaram2017-11-031-2/+2
* 3877Kartik K. Agaram2017-05-261-7/+7
* 3707Kartik K. Agaram2016-12-121-2/+2
* 3654Kartik K. Agaram2016-11-081-2/+8
* 3643Kartik K. Agaram2016-11-071-1/+1
* 3553Kartik K. Agaram2016-10-221-1/+1
* 3522Kartik K. Agaram2016-10-191-3/+3
* 3380Kartik K. Agaram2016-09-171-4/+4
* 3309Kartik K. Agaram2016-09-091-7/+9
* 3120Kartik K. Agaram2016-07-211-7/+7
* 3108Kartik K. Agaram2016-07-101-1/+0
* 3061Kartik K. Agaram2016-06-171-0/+1
* 3046Kartik K. Agaram2016-06-111-1/+1
* 2990Kartik K. Agaram2016-05-201-2/+2
* 2931 - be explicit about making copiesKartik K. Agaram2016-05-061-2/+2
* 2893Kartik K. Agaram2016-05-031-0/+219
#dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
-- title:  pomo
-- author: eli_oat
-- about:  a very tiny pomodoro timer

local pomo = {
    _version = "2022.03"
}

local defaults = {
    pomoTime = 1500,    -- time for a pomodoro in seconds
    restTime = 600,     -- time for a short rest in seconds
    longRestTime = 900, -- time for a long rest in sseconds
    pomoCount = 0       -- used to count pomodoros before a long rest
}

local pomoTime = defaults.pomoTime
local restTime = defaults.restTime
local longRestTime = defaults.longRestTime
local pomoCount = defaults.pomoCount

local function sleep (a)
    local sec = tonumber(os.clock() + a)
    while (os.clock() < sec) do
    end
end

local function prettyTime (timeInSeconds)
    local minutes = math.floor(timeInSeconds / 60)
    local seconds = timeInSeconds % 60
    local timeDisplay = string.format('%02d:%02d', minutes, seconds)
    return timeDisplay
end

function pomo ()
    os.execute('clear')
    repeat
        io.write('🍅 ' .. prettyTime(pomoTime) .. '\n')
        pomoTime = pomoTime - 1
        sleep(1)
        os.execute('clear')
    until pomoTime == 0

    while pomoTime == 0 and pomoCount < 4 do
        io.write('😴 ' .. prettyTime(restTime) .. '\n')
        restTime = restTime - 1
        sleep(1)
        os.execute('clear')
        while restTime == 0 do
            restTime = defaults.restTime
            pomoTime = defaults.pomoTime
            pomoCount = pomoCount + 1
            pomo()
        end
    end

    while pomoCount == 4 do
        io.write('🍹 LONG REST! ' .. prettyTime(longRestTime) .. '\n')
        longRestTime = longRestTime - 1
        sleep(1)
        os.execute('clear')
        while longRestTime == 0 do
            restTime = defaults.restTime
            pomoTime = defaults.pomoTime
            longRestTime = defaults.longRestTime
            pomoCount = defaults.pomoCount
            pomo()
        end
    end
end

return pomo