Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A meditation reminder app when I'm using the computer
# This Python file uses the following encoding: utf-8
import subprocess
import time
breathing_time = 30 # seconds
interval_between_breathing = 25 * 60 # seconds
applescript = """
display dialog "Breathe and make a home of your body" ¬
with title "Breathe" ¬
with icon caution ¬
buttons {"OK"}
def ding():"afplay /System/Library/Sounds/Glass.aiff", shell=True)
while True:
idle_time = int(subprocess.check_output('ioreg -c IOHIDSystem | egrep "HIDIdle" | egrep -o "\d+"', shell=True)) / 1.0e9 # seconds
if idle_time < 60: # seconds"osascript -e '{}'".format(applescript), shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.