After more investigation, I can tell that the “q” key stuff starts happening when Electrum unlocks the wallet.
If I plug the Ledger in, start the relevant app on it and do nothing, no “q” key occurs. When I launch Electrum, nothing more happens. But as soon as I select the “use hardware wallet” option, it all starts again.
Here is a Xev output:
KeyRelease event, serial 37, synthetic NO, window 0x3e00001,
root 0x10f, subw 0x0, time 77300046, (41,84), root:(912,547),
state 0x10, keycode 38 (keysym 0x71, q), same_screen YES,
XLookupString gives 1 bytes: (71) “q”
XFilterEvent returns: False
Any ideas, please?