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.)
I mean, as you note, Wayland almost certainly can't provide this kind of functionality by design. It offers some ways to fake input, but AFAIK no way to hook/listen to input events without hoping that each compositor adds a way to do so. In contrast, X11 trivially enables read and write access to input events, as well as the ability to intercept input and rewrite it before applications see it. Also, while many distros now ship Wayland as the nominal default, last I'd seen it was actually used by a minority of users compared to Xorg (if we exclude ChromeOS, which seems reasonable for this conversation).
> Also, while many distros now ship Wayland as the nominal default, last I'd seen it was actually used by a minority of users compared to Xorg
You touched a good point. The one and only metric to measure success in software is the number of active users. However, i do not know of any statistics Xorg vs. Wayland users. Personally, i have no reason to switch away from X11. In contrary, it was and is a loyal companion now already for decades. I trust the Lindy effect that X11 will stay relevant for a very long time. So kudos for the OP for creating this!
Different people care about different features. If you want fractional scaling and can't get it on X11, use Wayland. If you want AHK, use X11. Unfortunately, neither option currently has all the features of the other.
Wayland has had very little traction outside of RH and other corp-heavy groups. It didn't work for too long, now it works and still requires an X server to do anything useful while having less applications, worse features, higher resource usage in the available systems. I haven't seen anything to motivate me to try to switch since the "new shiny" wore off a decade or so ago.
I used i3 on older laptops, and decided to try switching to Sway when I got my current laptop 16 months ago. I’ve switched back to i3 on it on a few occasions for screen sharing in Zoom, and wow, I’d forgotten how bad the tearing is, and how not-great the management of inputs and outputs (though this is unlikely to affect full desktop environments like GNOME and KDE), and how annoying it is to not be able to use my XF86AudioMicMute key because its key code is 256 (it was a pain to get working in Sway, requiring xkb_file with a manually-tweaked keymap, but as far as I can tell it’s simply not possible under Xorg which has a hard limit of 255). Plus scaling simply doesn’t work at all well in X/i3, to say nothing of flat-out not supporting mixed scaling, whereas it all just works in Sway (the only apps I have to tweak are ones run via Xwayland, which sometimes but don’t always get it right out of the box).
I haven't seen screen tearing anywhere in more than a decade, so that doesn't have much weight with me, but I can see how it could be an issue for video editing (if OBS is what Google suggests it is). Now I'm interested in why X and Wayland would be different - screen tearing seems like it would be at a lower level (mesa?) than the display server? I don't understand how any of a modern graphics stack actually works though.
>Isn’t it a bit late to do something like this tied to X?
At the moment, Wayland is used only by a minority of users, and most are still on X11. Sure, distros may often default to Wayland, yet almost no distro has switched the user's default upon upgrading.
Most users aren't new users or installing on new systems, and even for new users X is occasionally still default (e.g. every existing BSD, some KDE distros).
I estimate it's another 5 years before another new computer cycle and Wayland maturing will make X less relevant. 15-25-more years before we could even consider removing support.
Wayland will be an interesting challenge, but I think there's still plenty of time before that happens.
If we figure out that this kind of automation is impossible on Wayland, I think it should still be possible to hook into the raw keyboard events with kbd and such, no? Requires root though.
(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.)