-
-
Save pmcfernandes/6f65d9a3e4406370e91463cf77af6a0c 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. | |
#> | |
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