Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, Anyone happen to know of a way to set the focus to a particular window via a shell command? I have a perl application that invokes xine, then ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    1

    Setting focus via the command prompt?


    Hi all,

    Anyone happen to know of a way to set the focus to a particular window via a shell command? I have a perl application that invokes xine, then goes into a raw character mode to consume characters from the terminal. Unfortunately, when xine is invoked, the focus is switched out of the terminal window and I have to move the mouse in order to reestablish focus. Since the program is all about speed and efficiency, I do not want to have to do this. Any ideas? I'm assuming I'd start by using 'xwininfo' to establish the id of the window I want focus placed into, but once I have said id, what program do I pass it to? If there isn't one, I can obviously write a tiny little X app that will do it (which will probably take a few days of manual reading) or someone can send me the presumably 10 lines of code necessary and I'll be eternally grateful :- )

    Hmmm. While I'm on this track, how about a means of moving the mouse to a particular position on the desktop via a command-line prompt? That would also do the trick, since I could just move the mouse into my window (and since I have 'focus-on-over' set, that should be sufficient).

    Thanks in advance,
    Wade
    Last edited by meta; 01-02-2007 at 11:06 PM. Reason: Try to figure out how to get the little blue ? to appear

  2. #2
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942
    The wmctrl program would be useful here.
    Flies of a particular kind, i.e. time-flies, are fond of an arrow.

    Registered Linux User #408794

  3. #3
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    wmctrl should do the trick
    http://www.sweb.cz/tripie/utils/wmctrl/

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •