Get your own customer support community
 

How to get frontmost X11 app on OS X

Different X windows (X11) apps all show up as just as 'X11' in RescueTime. It'd be nice if they were broken out per app.

Here's a way to get the name of the frontmost X11 app:
/usr/X11/bin/xprop -id `/usr/X11/bin/xprop -root |awk '/_NET_ACTIVE_WINDOW/ {print $5; exit;}'` WM_CLASS

It'll print something like this:

WM_CLASS(STRING) = "xterm", "XTerm"

or

WM_CLASS(STRING) = "emacs", "Emacs"

Of course, that'll only work if X11 is installed - for lots of users, /usr/X11 might not exist.
Hope this helps!
 
happy I’m cautiously optimistic
Inappropriate?
1 person likes this idea

User_default_medium