Last active
April 29, 2019 16:30
-
-
Save SQLvariant/e828556219b891d03412c8312d0798e5 to your computer and use it in GitHub Desktop.
A PowerShell function to create Pomodoro timer. Defaults to 25 minute timer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# 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