Isn’t it a bit late to do something like this tied to X? I get the impression almost all distributions now default to Wayland. This feels like something that would have been good a decade ago, but is too late now.

(Mind you, this would be a good deal harder to implement in Wayland, where possible at all, since Wayland is predicated around a security model where this kind of thing is deliberately not supported. You can either go with something compositor-specific, and I don’t know if this is possible for all compositors, though I get the impression that it should be possible for at least wlroots; or work more the way ydotool does, where possible, in basically providing a fake input device.)

There is some rough functionality for operations with wlroots via wlrctl https://git.sr.ht/~brocellous/wlrctl and more generically (via uinput) ydotool https://github.com/ReimuNotMoe/ydotool