I want to record the active application and save a history of my active applications. I say active application because if I run an application and It's minimized, etc I would not count it as an active application. In order to make my question more clear let's look at this example. I open Firefox and surf the web for 20 minutes. Then I open a text editor and start writing for 5 minutes (Firefox is running but I don't use it and so Firefox should not be counted as an active application). So I should be able to record the following information:
Firefox -> 20 minutes
Text editor -> 5 minutes
I want to track each used application during the OS (Linux is preferred) is on and make an open source application that says how much you use each application.
UPDATE : the application that I want to record is the application that user see on the display and is working with. For instance you might change the windows size in such a way that you can see both Firefox and Text editor (alongside, in different work-space, cascaded, etc), but you are typing in text editor, therefore, the text editor is the active application. In other word the application is active if you are interacting with or is the last interacted app that you are looking at to read some thing in pdf, text, etc. Interacting with the application: I mean clicking, typing, scrolling, etc.
NARROWING : The only thing that i can not figure out is how to get the active application with these conditions. I think if I get the topest application on the display in the current workspace that would solve the problem, hoever, we have a property to set to a windows (always on top) that might need to get without this property enabled. I have found this question that might help to answer.
Using Fedora 26,
Thanks in advance.