How can we measure that in a given period, what window was on the top? (active one)
I already tried based on "wmctrl", but I can't show the currently active window.. in the second example I tried with ":ACTIVE:", it showed ALL again, but only the terminal was the active then..
$ wmctrl -l | awk '$2 != "-1"'
0x044006a3 8 notebook Mozilla Firefox
0x0456fb4c 0 notebook How to measure that how much time is the active window opened? - Unix & Linux Stack Exchange - Mozilla Firefox
0x03000004 0 notebook Terminal
$
$ wmctrl -l :ACTIVE: | awk '$2 != "-1"'
0x044006a3 8 notebook Mozilla Firefox
0x0456fb4c 0 notebook How to measure that how much time is the active window opened? - Unix & Linux Stack Exchange - Mozilla Firefox
0x03000004 0 notebook Terminal
$
Purpose: The output would be something like this (from an example 8 hour shift, so 480 minutes):
MINUTE TASK
195 Mozilla Firefox
165 Terminal
74 Thunderbird
36 Idle (was away, machine locked, no app was on top..)
10 Unknown (the machine wasn't powered on)
With the awk '$2 != "-1"'
I just excluded the "Bottom Expanded Edge Panel".
Question: I only need the part that how can I show the currently active window. I can do the part where I run a script in ex.: every 10 seconds and gather the time information.
p.s.: I'm using Ubuntu 12.04 or CentOS 6 both with GNOME.