Is there a way to find the id and maybe the path or the type(browser, …) of the front most window in X?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To find out the window ID, try:
Window properties:
One way to accomplish this is to parse the output of this command inside your application. The topmost window is the last on the list.
EDIT:
If you need to retrieve the process ID from the window ID, there’s a small application here that shows how to do this trick. I successfully compiled it with:
g++ win_procid.cpp -o win_procid -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libgtop-2.0 -lXtst -lgtop-2.0I had to install the package libgtop2-dev because I didn’t have it on my system.