- Real-time tracking of active window titles.
- Time spent on each application is logged for later analysis.
- Ability to generate reports based on screentime data.
- Simple and intuitive user interface.
- Secure local data storage using SQLite.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
What you need to install the software:
- CMake (Version 3.26 or higher)
- A C++17 compatible compiler
- SQLite3
A step by step series of examples that tell you how to get a development environment running:
Clone the repository:
git clone https://github.com/yourusername/desktop_screentime.git
Navigate to the project repository:
cd desktop_screentime
Build the project with CMake:
cmake -B build
cmake --build build
Run the application:
./build/desktop_screentime
How to run the automated tests for this system:
cd build
ctest
- C++ - Primary programming language.
- CMake - Build System
- SQLite - Data Storage.
- GoogleTest - Testing Framework.
- Windows API - Active Window Tracking.
The following example initializes the tracking process in a separate thread and waits for user input to stop tracking. It demonstrates how to integrate the Desktop Screentime Tracker into your C++ application.
#include "AppTracker.h"
#include <atomic>
#include <iostream>
#include <thread>
std::atomic<bool> trackingActive(true); // Global flag to control tracking
AppTracker appTracker;
void startTrackingWrapper()
{
appTracker.startTracking(); // Pass the flag to the tracking function
}
int main()
{
// Start tracking in a separate thread
std::thread trackingThread(startTrackingWrapper);
// Wait for user input
std::cout << "Press Enter to stop tracking..." << std::endl;
std::cin.get(); // Wait for Enter key
// Stop tracking
appTracker.stopTracking();
// Join the thread
if (trackingThread.joinable()) {
trackingThread.join();
}
std::cout << "Tracking stopped." << std::endl;
return 0;
}
See the tests directory for more examples of how to use the interface.
Contributions to this project are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License. Feel free to use and modify the code as per the license terms.