Controling focus from command line or script
I have a perl script running in xterm on KDE. As a part of it's execution script runs 'display some_image.jpg &' and ask user to provide information related to displayed image. My problem is what while running 'display' my original terminal where the script is running loose the focus and user have to move or click mous to return focus. I wonder if there is any command line or script control over focus in X windows. I have found some info on possibility to send messages to X server from command line but my information is not complete and I can go on without sample code at least.
Thanks for your help.