A Python application that monitors the screen for a specific image and plays an alarm sound when detected.
- Monitors screen for image detection using computer vision
- Plays alarm sound when the target image is found
- Configurable confidence level for image detection
- Python 3.12 or higher
uvpackage manager
- Clone or download this project
- Navigate to the project directory:
cd alarm - Install dependencies using
uv:uv sync
Before running the application, you need to prepare the following files:
-
popup.png - Screenshot of the image you want to detect
- Take a screenshot of the popup or window you want to monitor
- Save it as
popup.pngin the project directory
-
alarm.mp3 - Audio file to play as alarm
- Prepare an MP3 audio file
- Save it as
alarm.mp3in the project directory
Run the application using uv:
uv run jupyter notebook alarm.ipynbOr activate the virtual environment and run directly:
source .venv/bin/activate # On Windows: .venv\Scripts\Activate.ps1
jupyter notebook alarm.ipynb- The program starts monitoring your screen every second
- It searches for the image
popup.pngon your screen - When the image is detected with at least 90% confidence, it:
- Prints "Image found!"
- Loads and plays
alarm.mp3 - Exits the program
You can adjust the detection parameters in the code:
- filename: Change
'popup.png'to your image file name - confidence: Modify the confidence level (0.0 to 1.0) - higher values require more precise matches
The project uses pyproject.toml for dependency management, which includes:
- pyautogui: For screen automation and image detection
- pygame: For audio playback
- opencv-python: For advanced image matching
- Pillow: For image processing support
Dependencies are managed by uv which generates a uv.lock file for reproducible installs.
- Image not found: Make sure
popup.pngis in the project directory and visible on screen - Audio not playing: Verify
alarm.mp3exists and is in the correct format - pyautogui issues: On some systems, you may need additional dependencies for screenshot functionality
This project is provided as-is for personal use.