I have a puzzling (to me) observation. In the course of marking lots of exercise, I'm doing, repeatedly,
mupdf -geometry +0+0 *.pdf & emacs q3.txt ; sleep 0.1; xdotool search .pdf key q The purpose of the xdotool is so that mupdf receives a quit command and saves its history file, rather than being killed. (The sleep 0.1 (using a local sleep that accepts floating point) is to address another issue.) Almost invariably, xdotool gets a BadWindowError when it tries to send the KeyUp event, presumably because by then mupdf has already quit and accepts no more events. Sometimes, something weird happens: the window that then has focus (usually an xterm or emacs) gets auto-repeating q's until I press and release another key. I don't see how sending a synthetic keydown to a client can affect the state of the keyboard for other clients. X.Org X Server 1.20.13 running on Ubuntu 20.04.4 LTS.