I am a digital artist, using Clip Studio Paint (a Windows app) to draw, through Wine. It would be interesting to know how many hours each piece takes me. But being how I am, most of the time I just forget to set up a chronometer to measure or to stop it after I end or during a break.

Would it be possible to have a script that logs how much time a window is active, so I can add that up and get a time?

EDIT: When I talk about the window being active, I specifically talk about the window being in focus, not just the program running, so that if I get distracted and alt-tab out I can get later a closer idea of how much I actually worked.

  • you could edit your question to include what you've mentioned in the comment to the answer below. Perhaps, clarify exactly what you mean by "active": your twitter example makes things quite complicated! – DK Bose Apr 30 '20 at 10:07
  • Script is very well possible, but how to distiguish the window? What is the wm class? Specific title etc? – Jacob Vlijm Apr 30 '20 at 18:18

Each time you are launching a process a timer is launched, you can see it under TIME+ using the top command

So if you want to know how long wine has been launch you can find the wine process on top or using this command ps -aux | grep wine it will be the time after the date

  • That is good to know! But I was wondering more specifically about just the time where the wine window is the active one. I don't want to also measure the forty minute gap I got distracted on twitter with the window open for example. – metichi Oct 3 '19 at 12:04
  • I suppose it depend on the way this application was build, what you should do is once your application is run is wine do a ps -aux | grep wine see the process, then open your new window in your application and do a ps -aux | grep again to see the new process running, it will be the one you are looking for – Saxtheowl Oct 3 '19 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.