xdotool send keystroke even when windows does not have focus
0
votes
0
answers
672
views
I've written the attached script in order to keep my external monitor alive while I'm not typing on it. I'm using
fvwm
, and have multiple named windows open. The script successfully types A every second to a named window, but it only works when the window has focus. How can I modify the script so that it continues to type even when the window doesn't have focus? Presumably I can use the behave
option to xdotool
somehow to do this, but the syntax for xdotool
with behave
seems impossibly arcane
#!/bin/bash
tmpTITLE=STARTUP0
if [ $# -eq 1 ] ; then
tmpTITLE=$1
fi
Window=wmctrl -lp | grep $tmpTITLE | cut -d" " -f 1
while sleep 1 ; do xdotool key --window $Window A; done
Asked by Leo Simon
(453 rep)
Sep 28, 2019, 10:16 PM