from git_monitor.logger import logger try: from plyer import notification PLYER_AVAILABLE = True except ImportError: logger.warning("plyer not found. Will try win10toast.") PLYER_AVAILABLE = False try: from win10toast import ToastNotifier WIN10TOAST_AVAILABLE = True toaster = ToastNotifier() except ImportError: WIN10TOAST_AVAILABLE = False class Notifier: def notify(self, title, message): logger.info(f"Notification: {title} - {message}") # Try plyer first if PLYER_AVAILABLE: try: notification.notify( title=title, message=message, app_name="Git Monitor" ) return except Exception as e: logger.error(f"Plyer notification failed: {e}. Trying fallback...") # Fallback to win10toast if WIN10TOAST_AVAILABLE: try: # threaded=True prevents blocking the app toaster.show_toast(title, message, duration=5, threaded=True) return except Exception as e: logger.error(f"win10toast notification failed: {e}") # Final fallback to stdout print(f"[{title}] {message}") notifier = Notifier()