2

I'm trying to write a short bash script that opens some gnome-terminals and runs a program and issues keystrokes to them. Got parts 1 & 2 done and working. I am trying to use xdotool to do part three, sending keystrokes to those terminals. At this point, I cannot get xdotool to send keys with the key command to any other terminals.

I tried:

xdotool key a  

and it worked as expected (mostly):

[uname@computer ~]$ xdotool key a  
a[uname@computer ~]$ a  

The 1st a in front of the command prompt is a bit funky, but whatever. An a appeared. Great.

Then I tried opening another terminal window, and running:

a[uname@computer ~]$ xdotool search --class gnome-terminal key --window %@ a
[uname@computer ~]$ 

and nothing happened in either terminal. The way I understand it from the documentation, you can chain commands like this, and if you do the first search command puts the terminal windows in the WINDOW STACK which is accessed by the %@, or %N in the key command. I have tried with xterm as well, similarly disappointing results ensued. I also tried:
Running that same command and a version of it with getactivewindow instead in a bash script, same results (or lack of).
Running the commands separately from a bash script, i.e.:

xdotool search --class gnome-terminal  
xdotool key --window %@ w

The output:

[uname@computer ~]$ ./test_xdo.sh   
50331649  
50339261  
50332317  
There are no windows on the stack, Can't continue.

I have looked for this problem, and found similar issues, but nothing with the exact same issue and therefore the fix I need. Any help would be greatly appreciated.
Oh and I'm running RedHat Ootpa.

[uname@computer ~]$ cat /etc/redhat-release   
Red Hat Enterprise Linux release 8.5 (Ootpa)  
[uname@computer ~]$ uname -r  
4.18.0-348.20.1.el8_5.x86_64  
[uname@computer ~]$ xdotool -v  
xdotool version 3.20200624.1  
shellter
  • 36,525
  • 7
  • 83
  • 90
Adam Mills
  • 21
  • 4

0 Answers0