Skip to content

Commit 91f35a7

Browse files
authored
Create water_break_reminder.py
1 parent e706727 commit 91f35a7

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

water_break_reminder.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import time
2+
import datetime
3+
import platform
4+
import os
5+
6+
# Time between reminders (in seconds) — 30 minutes = 1800 seconds
7+
REMINDER_INTERVAL = 1800
8+
9+
MESSAGES = [
10+
"💧 Time to drink some water!",
11+
"👀 Look away from the screen for 20 seconds to relax your eyes.",
12+
"🧍‍♀️ Stand up and stretch your legs!",
13+
"☕ Take a short break — you’ve earned it!"
14+
]
15+
16+
def notify(message: str):
17+
"""Display a system notification or terminal message."""
18+
print(f"[{datetime.datetime.now().strftime('%H:%M:%S')}] {message}")
19+
20+
# Use native notifications if available
21+
if platform.system() == "Darwin": # macOS
22+
os.system(f"osascript -e 'display notification \"{message}\" with title \"Break Reminder\"'")
23+
elif platform.system() == "Linux":
24+
os.system(f"notify-send 'Break Reminder' '{message}'")
25+
elif platform.system() == "Windows":
26+
# Windows toast notification via powershell
27+
os.system(f'powershell -Command "New-BurntToastNotification -Text \'{message}\'"')
28+
29+
def main():
30+
print("🔔 Break Reminder is running... (Press Ctrl+C to stop)")
31+
while True:
32+
for msg in MESSAGES:
33+
notify(msg)
34+
time.sleep(REMINDER_INTERVAL)
35+
36+
if __name__ == "__main__":
37+
try:
38+
main()
39+
except KeyboardInterrupt:
40+
print("\n🛑 Break Reminder stopped. Take care of yourself!")

0 commit comments

Comments
 (0)