A simple Python script to track how much time you spend on different applications.
Make sure you have Python installed.
- Create a virtual environment (optional but recommended):
python -m venv myEnv
- Activate the virtual environment:
-
On Windows:
myEnv\Scripts\activate
-
On macOS and Linux:
source myEnv/bin/activate
-
Clone this repository or download the Python script (
time_tracker.py
) to your computer. -
Navigate to the directory where you saved
time_tracker.py
in your terminal. -
Run the script using Python:
python time_tracker.py
- The script will start tracking the time spent on each application you use. It will update in real-time as you switch between applications.
- To stop the script, press
Ctrl + C
in the terminal.
The script will record the time spent on each application in a file named "TrackRecords.txt" in the same directory where the script is located. Each entry in the file includes the current date and time, as well as the time spent on the application.
You can open "TrackRecords.txt" to view your application usage history.
- Start on PC Startup
- Run In Background
- Barebone UI in Electron or a Simpler Way (Python)
- Add data analysis and visualization features
- Implement data persistence between script runs
- Add a Database
-
This script monitors active windows, so it may not work perfectly on all systems due to differences in window management between operating systems.
-
The script does not persist data between runs. It appends data to the "TrackRecords.txt" file, so make sure to save or analyze the data as needed before running the script again.
-
Ensure that you have the necessary permissions to write to the directory where the script is located to save the tracking data.
-
To analyze the data further or create visualizations, you can import the data from "TrackRecords.txt" into a spreadsheet or use data analysis tools.