Last active
December 15, 2015 05:59
-
-
Save granolocks/5213165 to your computer and use it in GitHub Desktop.
motivational 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
| #!/usr/bin/env ruby | |
| # I use this on Crunchbang and xubuntu systems. | |
| # May need to be modified depending on availability of notify-send as well as icons | |
| def time | |
| sleep 300 | |
| end | |
| def notify(urgency, icon, title, message) | |
| `notify-send -u #{urgency} -i #{icon} '#{title}' '#{message}'` | |
| end | |
| pid = fork { | |
| while true | |
| time | |
| notify("critical", "face-devilish","WORK OUT NOW", "work out work out work out") | |
| time | |
| notify("critical", "face-cool", "STRETCH!!", "stretch stretch stretch stretch stretch stretch ") | |
| end | |
| } | |
| # Might need to set up permissions for /var/run/timer.pid | |
| File.open("/var/run/timer.pid", "w"){|f|f.write(pid); f.close} |
Ooohhh never mind I see what you're doing hahah
Author
Ya, i just wanna capture the pid so i can kill it later
been leaving this running all day...
Don't forget to STRETCH!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Process.wait(pid) ;)