1

I've bashed my head against this problem for a while and I'm at a dead end.

I'm simply trying to send one key input to an unfocused window using the xdotool key --window window_id function. The window is found, but nothing registers.

To simplify: I open two terminal windows. I run xdotool getactivewindow in terminal window A and get the window_ID. I run xdotool key --window "window_ID_A" x in terminal window B, the code runs, but nothing happens.

I've run some sanity checks like sleep 5; xdotool key x and then manually changing focus to terminal window A, which works as intended. I've tried running sleep 5; xdotool key --window "window_ID_A" x and changing focus manually, but with no result. When I enter a bogus window_ID: xdotool key --window "window_ID_C" x xdotool correctly reverts to using the focused window as the target, which leads me to believe that the correct window is being found in the original code. I've tried running --clearmodifiers, using notepad or libreoffice as my target window and even running with sudo, with no change. Nothing I try will make the --window function work.

Is there anything that might specifically hinder this functionality?

I'm running linux mint 20, Xfce 64-bit, x11

I usually figure these sorts of things out on my own eventually, but this is driving me nuts. Any help is hugely appreciated!

Edit: The only workaround I've manage to come up with is this: tmp=$(xdotool getactivewindow); xdotool windowactivate --sync $(xdotool search --name "window_name") key x; xdotool windowactivate $tmp Which is not a great workaround since my screen will flick to the other window and back, every time I run the script.

weons
  • 11

0 Answers0