Skip to content

Instantly share code, notes, and snippets.

@pmcfernandes
Forked from SQLvariant/Start-Pomodoro.ps1
Created April 29, 2019 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmcfernandes/6f65d9a3e4406370e91463cf77af6a0c to your computer and use it in GitHub Desktop.
Save pmcfernandes/6f65d9a3e4406370e91463cf77af6a0c to your computer and use it in GitHub Desktop.
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.
#>
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