[texhax] controlling pdf reader (was Re: beamer and "Read out loud")

James Quirk jjq at galcit.caltech.edu
Mon Apr 19 04:47:53 CEST 2010


> (ii) Add the following perl to your atchange script:
> my $wid= (`xdotool search --title "Adobe Reader"`)[0]; chomp $wid;
> system("xdotool key --window $wid ctrl+r");
It seems that the  --window option is not the thing to use,
for reading from the manual page:

Sending keystrokes to a specific window uses a different API than simply 
typing to the active window. If you specify 'xdotool type --win‐
       dow 12345 hello' xdotool will generate key events and send them 
directly to window 12345.  However, X11 servers will set a special flag
       on all events generated in this way (see XEvent.xany.send_event in 
X11's manual). Many programs observe this flag and reject these

Therefore this variant is to be preferred:

chomp(my $wid= (qx{xdotool search --title "Adobe Reader"})[0]);
system("xdotool windowactivate $wid");
system("xdotool key --window $wid ctrl+r");

And as a concrete exmaple of the difference between the two:
the former can't copy with AR's single-key accelerator, h and
z, for hand and zoom modes, whereas the latter can.


More information about the texhax mailing list