Distraction Slayer is a Python script designed to help you maintain focus by detecting distracting websites or applications while you work. When a distraction is detected, it automatically closes the distracting software or the browser tab. Additionally, you have the option to integrate an Arduino board equipped with a taser or loud buzzer to provide a physical reminder to stay focused.
Before running the Python script, ensure you have the required libraries installed. You can install them using pip:
pip install python-dotenv
pip install openai
pip install pygetwindow
To use the Arduino functionality, install pyserial:
pip install pyserial
To use Distraction Slayer with an Arduino board, follow these steps:
-
Upload the provided Arduino code to your Arduino board. This code includes functionality for controlling an indicator, such as a buzzer or taser.
-
Connect the indicator (buzzer/taser) to the appropriate pin on your Arduino board, as specified in the uploaded Arduino code.
-
Ensure your Arduino board is connected to your computer via USB.
Before running the Python script, make sure to configure the following:
-
ChatGPT API Key: Enter your ChatGPT API key in the .env file.
-
Arduino Board's Port: If you want use Arduino functionality, add your Arduino board's port to the main.py file. Otherwise, leave it black like this.
arduino = serial.Serial(port='', baudrate=9600, timeout=.1) -
Close Arduino IDE: Make sure to close the Arduino IDE before executing the Python script to prevent interference with the Arduino board's port.
Once you have completed the setup, you can run the main Python script. Simply execute the following command:
python main.py
The script will monitor your screen activity and identify distracting websites or applications based on your configuration. If an Arduino is connected, the indicator on your Arduino board will activate when distractions are detected. This will automatically close the distracting application or browser tab.
Additionally, Distraction Slayer utilizes the OpenAI API to identify the type of videos the user watches on YouTube.
You can customize the behavior of Distraction Slayer by modifying the configuration options in the main.py file.
- This project was inspired by the need to maintain focus in an increasingly distracting digital environment.