<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 4ndriiK0</title>
    <description>The latest articles on DEV Community by 4ndriiK0 (@4ndriik0).</description>
    <link>https://dev.to/4ndriik0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3769343%2F37bac398-5c8b-4195-9d43-7ed7b2b4d554.png</url>
      <title>DEV Community: 4ndriiK0</title>
      <link>https://dev.to/4ndriik0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/4ndriik0"/>
    <language>en</language>
    <item>
      <title>Building a Private Productivity Tracker from Scratch with C++ and Crow</title>
      <dc:creator>4ndriiK0</dc:creator>
      <pubDate>Thu, 12 Feb 2026 17:48:32 +0000</pubDate>
      <link>https://dev.to/4ndriik0/building-a-private-productivity-tracker-from-scratch-with-c-and-crow-1oae</link>
      <guid>https://dev.to/4ndriik0/building-a-private-productivity-tracker-from-scratch-with-c-and-crow-1oae</guid>
      <description>&lt;p&gt;As a developer, I often lose track of time while sitting at my computer. At the end of the day, it is hard to tell how many hours I actually spent coding versus how much time I spent gaming, browsing, or watching videos.&lt;/p&gt;

&lt;p&gt;There are many commercial tools available for this, but most of them require a subscription or upload your data to a cloud server. I wanted a solution that was completely private, lightweight, and transparent.&lt;/p&gt;

&lt;p&gt;I decided to build LocalFlow, a simple desktop monitor written in C++ that logs active window usage and presents the data in a local web dashboard.&lt;/p&gt;

&lt;p&gt;The Goal&lt;br&gt;
I wanted to answer a simple question: Where does my time go?&lt;/p&gt;

&lt;p&gt;I needed a tool that could distinguish between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Productivity: Using Visual Studio, Terminal, or Documentation.&lt;/li&gt;
&lt;li&gt;Gaming: Time spent playing specific games.&lt;/li&gt;
&lt;li&gt;Viewing: Time spent watching movies or streams (Netflix, YouTube, VLC) without input.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How It Works&lt;br&gt;
The application runs in the background and uses the Windows API to check the active window state.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Window Detection (C++ &amp;amp; WinAPI)&lt;br&gt;
The core loop uses GetForegroundWindow to identify which application is currently in focus. It extracts the process name (e.g., chrome.exe, valorant.exe, vlc.exe) and logs the duration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Handling Inactivity (AFK)&lt;br&gt;
A major issue with simple time trackers is that they keep counting if you walk away from the computer.&lt;br&gt;
I implemented an AFK detector using GetLastInputInfo. If there is no mouse or keyboard movement for a set period, the timer normally pauses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Intelligent "Viewing" Mode&lt;br&gt;
The standard AFK logic has a flaw: if I am watching a 2-hour movie, I am not moving the mouse, so the tracker would incorrectly mark me as "Inactive".&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To solve this, I added a check for Full Screen Mode.&lt;br&gt;
If the system detects no mouse movement, it checks the dimensions of the active window. If the window covers the entire screen (hiding the taskbar), the system assumes I am consuming media. Instead of pausing the timer as "AFK", it logs the time as "Viewing".&lt;/p&gt;

&lt;p&gt;Local Web Dashboard (Crow)&lt;br&gt;
Instead of building a complex desktop GUI, I embedded a C++ web server using Crow. This allows me to view my stats by simply opening &lt;a href="http://localhost:18080" rel="noopener noreferrer"&gt;http://localhost:18080&lt;/a&gt; in my browser.&lt;/p&gt;

&lt;p&gt;The frontend uses Chart.js to visualize the data. It clearly shows the breakdown of my day, separating active work, gaming sessions, and media viewing time.&lt;/p&gt;

&lt;p&gt;Technical Implementation&lt;br&gt;
The project is designed to be portable. It does not require an installer and keeps all data in local JSON files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language: C++ (for low-level system access and performance).&lt;/li&gt;
&lt;li&gt;Web Framework: Crow (Microframework for C++).&lt;/li&gt;
&lt;li&gt;Data Storage: JSON Lines (text-based logs).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conclusion&lt;br&gt;
This project was a great way to practice systems programming and web integration. It provides an honest look at my daily habits without sending any personal data to a third-party server.&lt;/p&gt;

&lt;p&gt;If you are interested in C++ development, WinAPI, or just want to see where your time goes, the source code is available on GitHub.&lt;/p&gt;

&lt;p&gt;Repository: github.com/4ndriiK0/LocalFlow&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>showdev</category>
      <category>opensource</category>
      <category>windows</category>
    </item>
  </channel>
</rss>
