Created
September 18, 2017 08:45
-
-
Save artkpv/60f1813d27d27f17431e154b9da63c59 to your computer and use it in GitHub Desktop.
Simple Powershell pomodoro timer with notification and logging
This file contains 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
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