Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A PowerShell function to create Pomodoro timer. Defaults to 25 minute timer.
<# PLEASE NOTE: I am not the original author of this function.
I found it online years ago, and have been using it ever since.
If you are the original author, please ping me and let me know,
so I can give you proper credit.
Based on another function in the PowerShell Gallery, the orginial author might be Nathan.Run() http://nathanhoneycutt.net/blog/a-pomodoro-timer-in-powershell/
#>
Function Start-Pomodoro
{
Param (
[int]$Minutes = 25
)
$seconds = $Minutes*60
$delay = 15 #seconds between ticks
for($i = $seconds; $i -gt 0; $i = $i - $delay)
{
$percentComplete = 100-(($i/$seconds)*100)
Write-Progress -SecondsRemaining $i `
-Activity "Pomodoro" `
-Status "Time remaining:" `
-PercentComplete $percentComplete
Start-Sleep -Seconds $delay
}
$player = New-Object System.Media.SoundPlayer "$home\Music\CTUring.wav"
1..6 | %{ $player.Play() ; sleep -m 1400 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.