I need a solution for getting the current active (focused) window information on a Gnome 2 desktop. I'm mostly interested in the process running that window and window title.
Is it possible?
SOLUTION:
Getting window title:
xwininfo -root -children | grep $(printf '%x\n' $(xdotool getwindowfocus)) | grep -oEi '"[^"]+"' | head -1 Getting process name:
ps -e | grep $(xdotool getwindowpid $(xdotool getwindowfocus)) | grep -v grep | awk '{print $4}' or:
cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm