Z
Z
Zaporozhchenko Oleg2017-07-10 00:38:21
System administration
Zaporozhchenko Oleg, 2017-07-10 00:38:21

Application for keeping track of active windows. How to write?

There was an idea to make for myself a small analogue of https://desktime.com/
I am only familiar with the web, what to watch, read, in order to write a daemon that will monitor active windows / processes?
Interested only under Ubuntu.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
4
4X_Pro, 2017-07-10
@c3gdlk

A list of all windows can be obtained using the xwininfo utility (xwininfo -tree -root), the current active - first, the identifier through
the Window Number will be in the very first line of this form:
_NET_ACTIVE_WINDOW (WINDOW): window id # 0x240000
Then get data about the window itself:
Name applications: _OB_APP_TITLE(UTF8_STRING)
Window title: _NET_WM_VISIBLE_NAME(UTF8_STRING) = "[email protected]: ~"
Accordingly, all that remains is to write a Perl script (or you can try Bash) that parses the output and saves the necessary data to the log or base.
If you really want to write not scripts, but a full-fledged C-application, then I advise you to study this code first .

A
Alex, 2017-07-10
@asilonos

What's wrong with Desktime? For myself, it's free. Staffcounter.net also has a good monitoring of active windows for Ubuntu.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question