@tj Apparently there's also `dotool' which works on "everything" (X, wayland, and directly on TTY), I haven't tried it though, and have no idea about wayland.
@TicklishHoneyBee Right! After much mucking about I managed to get ydotool working.
The package from the ubuntu mirrors was very old, so I installed it from the binaries on github. Added a systemd service to run ydotoold as my user, and set wrote the following script:
!/bin/bash
export YDOTOOL_SOCKET=/tmp/.ydotool_socket
# Release ctrl and alt
#ydotool key 56:0 29:0
sleep 0.2
ydotool type $(date --iso-8601)
The keyups turned out to be unnecessary. The delay is, unfortunately.