I wanted to write a time tracking software using python for windows. How do I approach finding the total screen time of individual applications? Is there any windows service which tracks the total on screen time spent by a particular application during its current session? Or is there some other approach which could be used?
maybe pywin32 is what you looking for:
from win32gui import GetWindowText, GetForegroundWindow
print(GetWindowText(GetForegroundWindow()))
you have to run in repeatedly in the background and calculate the total screen time by yourself.