Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from watchdog.events import PatternMatchingEventHandler
import time
from message import send_message
from windows_notification import show_windows_notification
import os


Expand All @@ -21,6 +22,8 @@ def __init__(self, config):
def on_created(self, event):
send_message(self.token, self.chat_id)
print("Sending message...")
# Uncoment the following line to enable windows notifications
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a more elegant way to enable windows notifications. I am currently working on mac support so I was thinking maybe the option to enable/disable windows notifications should be in the config

Suggested change
# Uncoment the following line to enable windows notifications
# Uncomment the following line to enable windows notifications

# show_windows_notification()
if os.path.exists(event.src_path):
os.remove(event.src_path) # Delete the screenshot we created

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
requests
toml
watchdog
watchdog
winsdk
31 changes: 31 additions & 0 deletions windows_notification.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import winsdk.windows.ui.notifications as notifications
import winsdk.windows.data.xml.dom as dom

# create notification objects
nManager = notifications.ToastNotificationManager
notifier = nManager.create_toast_notifier(r"C:\Python310\python.exe") # put your python path there.

# define the xml notification document.
tString = """
<toast scenario='urgent'>
<visual>
<binding template='ToastGeneric'>
<text>Solo Shuffle Queue!</text>
</binding>
</visual>

<actions>
<action content='Dismiss' arguments='action=dismiss'/>
</actions>
</toast>
"""

# load the xml document.
xDoc = dom.XmlDocument()
xDoc.load_xml(tString)
notification = notifications.ToastNotification(xDoc)

# display notification
def show_windows_notification():
notification = notifications.ToastNotification(xDoc)
notifier.show(notification)