Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which command line tools can I use to get the currently active application / window on each platform?

I'm trying to create an AIR application to log application usage and the only easy way to get information from the system with AIR is using command line tools and scraping stdout.

I know about tools like top and ps for OS X, but neither of them seems to tell me which application / window is active, maybe I shouldn't even be looking for processes? For my logging purposes I`d like to get the name and title of the currently active window (and application) as a start.

I`m primarily interested in OS X, but would be great to have Windows and Linux equivalents too for the future.

If no such tools exist yet, it would be great to get some pointers how to make them. I haven't done any OS level programming yet, but I'd think creating a command line tool should be one of the easier things to do (completely ignoring GUI frameworks).

like image 714
dain Avatar asked Oct 25 '22 14:10

dain


1 Answers

These two questions seem to be asking the same thing, unless I've misunderstood your question. Should be a good start for OS X:

Get the title of the current active Window/Document in Mac OS X Finding the Current Active Window in Mac OS X using Python

like image 171
Justin Garrick Avatar answered Nov 15 '22 08:11

Justin Garrick