Built to order

Screen Time Tracker for Windows with Weekly Productivity Reports (Python)

This project builds a Screen Time Tracker for Windows in Python that records which application is in the foreground, attributes the time to it, and turns a week of that log into a readable productivity report. It uses pywin32 to identify the active window, psutil to resolve the owning process, and SQLite to store every sample locally on the machine, with no cloud upload in the base build. The dashboard shows per-application totals, three editable categories, and a 0–100 productivity score for the week. Suitable for B.E./B.Tech final-year projects in Computer Science and IT.

Chat on WhatsApp — get a quotation

Computer / IT PythonSQLiteMatplotlibTkinterGitpsutilpywin32 win32guiWindows 10 Windows 11Software
Screen Time Tracker for Windows with Weekly Productivity Reports (Python) — project thumbnail preview
More project photos (2)

The problem

Most people who sit at a Windows PC all day have only a vague feeling about where their hours went, because Windows keeps no per-application history to read back. The Screen Time Tracker for Windows with Weekly Productivity Reports (Python) closes that gap by running in the background, sampling the foreground window every 5 seconds and writing each sample — application name, window title and seconds spent — into a local SQLite database. The dashboard shows today per application, and each week it compiles the log into a report: total time, productive share, the longest focus block, and a day-by-day table against a daily goal. Applications sit in three categories — productive, neutral and distracting — that the user edits, so the same hour of coding and the same hour of video are never scored the same way. All data stays on the machine; there is no account, no server and no upload in the base build.

SYSTEM FLOW

5 components 4 connections

Live flow
Drag to explore
100%
appForeground window

The active window on the Windows desktop: its title and owning process identify the app in use.

Follow the working sequence

How it works

End to end, the tracker is a loop: ask Windows what is in front, stamp it with the time, store it, and summarise it later. A background thread wakes every 5 seconds and calls win32gui.GetForegroundWindow, which returns the handle of the active window; win32gui.GetWindowText reads its title, and win32gui.GetWindowThreadProcessId gives the process ID, which psutil turns into an application name. The tracker adds 5 seconds to that application's daily total in SQLite, so a window held for a minute accumulates twelve samples, while a glance shorter than 5 seconds may be missed — the real trade-off behind the polling interval, since a shorter interval would catch briefer switches but write proportionally more rows. If no keyboard or mouse input arrives for 5 minutes, sampling pauses and the stretch is logged as idle. The dashboard and weekly report then aggregate the stored samples into per-application totals, category shares and the productivity score.

  1. The tracker starts with Windows, or on demand, and runs a background thread that wakes every 5 seconds.
  2. Each wake call reads the foreground window handle with win32gui.GetForegroundWindow and its title with win32gui.GetWindowText.
  3. The owning process is resolved with win32gui.GetWindowThreadProcessId and psutil, giving the application name behind the window.
  4. Five seconds are added to that application's total for the current day in the local SQLite log, keyed by application, window title and date.
  5. Idle stretches, where no keyboard or mouse input arrives for 5 minutes, pause sampling and are logged separately, so idle time never inflates an application's total.
  6. The dashboard and weekly report aggregate the log into per-application totals, category shares, daily goals and the 0–100 productivity score, exportable as PDF or CSV.

Tech stack:

  • Python 3
  • pywin32 · win32gui foreground-window calls
  • psutil · process resolution
  • SQLite · local time log
  • Tkinter · dashboard and report windows
  • Matplotlib · weekly charts
  • Windows 10 and Windows 11 · target platform
  • Git · version control
Parameter Value
Polling interval 5 seconds (configurable, design target)
Attribution unit 5 seconds per sample
Idle threshold 5 minutes of no input before sampling pauses
Storage SQLite file on the local machine, approximately 1 MB per month of logging (expected)
Categories 3 categories (productive, neutral, distracting — user-editable)
Report period 7 days per weekly report
Productivity score 0–100 scale, computed from category shares
Export formats PDF and CSV
Platform Windows 10 and Windows 11 (64-bit)
Python version Python 3.10 or newer

Project features

The tracker is built around four capabilities that matter most: honest foreground-window sampling, user-editable categories, a weekly report that reads like an answer instead of a dump, and privacy by construction. Foreground-window sampling uses win32gui.GetForegroundWindow to ask Windows which window is active, reads its title, and resolves the owning process with psutil, so time is attributed to the application actually in front of the user rather than to every program running in the background. Categories are stored per application in SQLite and can be changed at any time, with past days re-totalled under the new rules. The weekly report turns the raw log into totals, a day-by-day goal table and a 0–100 productivity score, exportable as PDF or CSV. And because every record stays in a local SQLite file, the tracker works fully offline and never sends usage data anywhere.

  • [Foreground-window sampling every 5 seconds] A background thread wakes every 5 seconds, asks Windows for the active window, and records the application name, window title and seconds spent — the only input the tracker needs.
  • [Per-application time attribution] Time is credited to the application actually in front of the user, with the window title kept alongside, so a browser tab change shows up as a different title rather than anonymous browser time.
  • [Three editable categories] Every application sits in one of three categories — productive, neutral or distracting — and the user can reassign any application; past days are re-totalled under the new rules immediately.
  • [Weekly productivity report] Each week compiles into totals, productive share, the longest focus block, a day-by-day goal table and week-on-week change, exportable as PDF or CSV.
  • [Daily goals and a 0–100 productivity score] The user sets a daily screen-time goal and the dashboard scores each day from its category shares, so progress is one number instead of a wall of rows.
  • [Idle detection] If no keyboard or mouse input arrives for 5 minutes, sampling pauses and the stretch is logged as idle, so idle time never inflates an application's total.
  • [Local-only storage] All records live in a SQLite file on the same machine; the base build has no account, no server and no upload, and it works fully offline.
  • [Fast local reporting] Re-aggregating a full week from the stored samples is a local SQLite query, not a cloud round trip: in the demo build, totalling 42 sample day-records (2,562 minutes) took 0.10–0.30 ms across runs.

What is included

  • Complete Python source code for the tracker, dashboard and report generator
  • Local SQLite schema and sample log for demonstration
  • Weekly report templates with PDF and CSV export
  • Project report PDF (background, mechanism, polling trade-off, results from the demo build)
  • PPT presentation for final review
  • Viva Q&A preparation document (foreground-window detection, psutil, SQLite, idle handling, privacy)
  • Setup and run guide for Windows 10 and Windows 11

Limitations & prerequisites

  • Windows only: foreground-window detection uses the Win32 API, so the tracker does not run on macOS or Linux without a rewrite of the sampling layer.
  • A glance shorter than the 5-second polling interval can be missed; shortening the interval catches briefer switches but writes proportionally more rows to the log.
  • Two activities inside one browser window, for example video and research tabs in Chrome, are counted under the browser unless the window title is used to split them.
  • Category labels are the user's judgement: the tracker measures time, it cannot judge whether a given hour of browsing was work or distraction.
  • Window titles are stored as text, so a renamed document or a changed tab title can split one activity across two rows in the log.
  • The base build has no cloud sync, no mobile companion and no website blocking; blocking and cross-device sync are future scope, not included features.

Frequently Asked Questions

Is this project suitable for a final-year project?

Yes — for Computer Science and IT students, because it combines operating-system interaction through the Win32 API, process handling with psutil, local database design in SQLite, and a reporting interface with charts and a scoring rule, all in one small desktop application that a student can explain end to end in a review. The polling-interval trade-off and the idle-handling rule give the review discussion concrete engineering decisions to defend.

How does the tracker know which application I am using?

Every 5 seconds it asks Windows for the foreground window with win32gui.GetForegroundWindow, reads the window title, and resolves the owning process with psutil, so the time is credited to the application actually in front of the user and not to programs running in the background. The window title is stored too, so the report can separate a video tab from a documentation tab inside the same browser.

Does my screen time data leave my computer?

No, your screen time data never leaves your computer: every sample is written to a SQLite file on the same machine, the dashboard and weekly reports read from that local file, and the base build contains no account, no server connection and no upload of any kind. The only way data leaves the machine is if the user deliberately exports a report as PDF or CSV.

What does the weekly report contain?

The report shows total screen time for the week, the productive share and the 0–100 score, a day-by-day table with totals and goal results, the longest uninterrupted focus block, the top applications by time, and the change versus the previous week. It is generated locally from the SQLite log and can be exported as PDF or CSV.

Can I change how applications are categorised?

Yes, each application belongs to one of three categories — productive, neutral or distracting — and you can reassign any application at any time from the Apps and Categories screen, with past days re-totalled under the new rule so the weekly score always reflects your current definitions. Changing a category updates the weekly score at once.

What do I need to run it?

A Windows 10 or Windows 11 PC (64-bit) with Python 3.10 or newer, plus three pip packages: pywin32, psutil and matplotlib. The tracker runs from the system tray, starts with Windows if configured, and needs no internet connection once installed.

Components & software requirements
  • Python 3
  • pywin32 · win32gui foreground-window calls
  • psutil · process resolution
  • SQLite · local time log
  • Tkinter · dashboard and report windows
  • Matplotlib · weekly charts
  • Windows 10 and Windows 11 · target platform
  • Git · version control
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Get a quotation