-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.py
More file actions
25 lines (21 loc) · 815 Bytes
/
notification.py
File metadata and controls
25 lines (21 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import platform
import subprocess
def play_chime(sound_path=None):
system = platform.system()
if system == "Darwin":
sound = sound_path or "/System/Library/Sounds/Glass.aiff"
subprocess.run(["afplay", sound])
elif system == "Linux":
sound = sound_path or "/usr/share/sounds/freedesktop/stereo/complete.oga"
subprocess.run(["paplay", sound])
elif system == "Windows":
import winsound
if sound_path:
winsound.PlaySound(sound_path, winsound.SND_FILENAME)
else:
winsound.MessageBeep()
def show_notification(message):
if platform.system() == "Darwin":
subprocess.run(["osascript", "-e", f'display notification "{message}" with title "Plan Verification"'])
else:
print(f"Notification: {message}")