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!
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!
1
person likes this idea
I like this idea!
Tell me when this idea gets some attention.
The more people who like this idea, the more it gets noticed.
The more people who like this idea, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?That's a great tip. I'll keep this in mind when we start getting more detailed information from specific types of applications.
Thank you!
Loading Profile...



EMPLOYEE