Link to home
Start Free TrialLog in
Avatar of aczire
aczire

asked on

Get window title in linux

Hai all, i need to develop a program to get the title of the active window and if it contains some words that are not allowed in the lab session i need to close it.Thatz the question in a nutshell.
Now i'll explian it a little more.
I'm studying. In our lab, the systems are mainly used to do our c,c++,java programs and we're permitted to browse the web in off lab hours.But most of us do these two at the same time i,e browse the net in our lab hours.Now i'm assigned by our HOD  to develop a tool to avoid this.What i need is a program to check the active window title continuously and if it contains some word like "FireFox,Opera,Orkut etc" it will spawn a command box to enter the Auth no: from our lab admin and if it is correct then allow the person to continue else close that window.This is coz when we are dng our lab peoples from other departments will be using it for browsing.
Now you got the main idea.Now tell me how to get the active window title, close it and start automatically upon system startup using C++. we're using RedHat,Debian, fedora etc........

Avatar of cup
cup

Which window manager are you using?  You can get the title but the API for each window manager is different, unless you use native-X.  You also have to make sure nobody plays with the X-windows resource file.  You can modify the resource file to disguise the title.  The app can pick the resource file from one of 13 places.
Avatar of aczire

ASKER

Hai,
we are using KDE.Now tell me how can i get the title of the active window and get a handle to close it if it confirms to the specifications.
ASKER CERTIFIED SOLUTION
Avatar of cup
cup

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aczire

ASKER

I'll check it out and tell u.Thanks a lot