Re: sending keystroke to unfocused window

Stefan Reichör <[email protected]>
Newsgroups gmane.comp.window-managers.ion.general
Message-ID <[email protected]>
Renee Klawitter writes:

> Hi!!
>
> Is it possible to send a keystroke to an unfocused window ? What I
> think of is emacslike C-M-v to scroll down in another (emacs-)window.
>
> If you have your editor on one side of a splitted frame and maybe a
> xpdf on the other, pressing META-v will send the <down key> event to
> xpdf. The appropriate keystroke could be chosen by the receiving
> window's window-info; and the receiving window itself could be chosen
> by tagging it.
>
> Could this be done by a script ? And if so, how ?

You can use xautomation to send keystrokes.

I have written an emacs interface for xte. You can find it here:
http://www.xsteve.at/prg/emacs/xte.el

I have a similar demand. The following two functions jump to the
recent window, send prior/next and switch back to the actual one:

(defun xte-recent-win-page-up ()
  (interactive)
  (xte [(hyper ?k) ?k prior sleep (hyper ?k) ?k]))

(defun xte-recent-win-page-down ()
  (interactive)
  (xte [(hyper ?k) ?k next sleep (hyper ?k) ?k]))


Note: I use hyper ?k ?k to switch to the most recent window.

Stefan.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.