Skip to content

Instantly share code, notes, and snippets.

@artkpv
Created September 18, 2017 08:45
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artkpv/60f1813d27d27f17431e154b9da63c59 to your computer and use it in GitHub Desktop.
Save artkpv/60f1813d27d27f17431e154b9da63c59 to your computer and use it in GitHub Desktop.
Simple Powershell pomodoro timer with notification and logging
function pomo {
# simple pomodoro timer:
# pomo [minutes]
param($minutes = 25)
$start = (get-date)
while ($true) {
$left = (get-date) - $start
if (($left.Minutes) -ge $minutes) { break }
[System.Console]::Out.Write("`r$($minutes - $left.Minutes)m left...")
sleep 3
}
$doneMsg= "$('{0:g}' -f (get-date)) The $($minutes)m pomo done."
[System.Console]::Out.Write("`r" + $doneMsg)
$doneMsg >> "~\.pomodoroes.log"
$sound = new-Object System.Media.SoundPlayer;
$sound.SoundLocation="c:\WINDOWS\Media\notify.wav";
$sound.Play();
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("PomoDone",0,"Done",0x1)
}
function pomolog {
cat "~\.pomodoroes.log"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment