Files
PyVtT/notify.py
Max P. 92d66fb46c Extracts notification logic into a reusable utility
Moves desktop notification functionality to a separate module for better code reuse and maintainability. Updates the main application to use the new utility.
2025-03-24 14:26:24 +01:00

22 lines
807 B
Python

import subprocess
def notify(title: str, message: str) -> None:
"""
Sends a desktop notification using the `notify-send` command.
Args:
title (str): The title of the notification.
message (str): The message content of the notification.
Raises:
subprocess.CalledProcessError: If the `notify-send` command fails.
Note:
This function requires the `notify-send` command to be available on the system.
It is typically available on Linux systems with a notification daemon running.
"""
try:
subprocess.run(["notify-send", "-a", "Voice to Text", "-i", "audio-input-microphone", title, message], check=True)
except subprocess.CalledProcessError as e:
print("Fehler beim Benachrichtigen mit 'notify-send'.")
print(e)