Hacker News new | ask | show | jobs
by shmerl 808 days ago
Yes: https://github.com/ReimuNotMoe/ydotool
2 comments

Besides the limitations others have mentioned users should be aware that since ydotool works by writing events directly into /dev/uinput the input will go to whatever happens to be focused at the moment. It will happily type your secrets into a chat window if you move the mouse at the wrong time.

There is no way to do the equivalent of xdotool type --window 0x600005 "my important input"

It's not like xdotool is so secure in the first place. X11 is one huge hole from that perspective. Anything can read anything and all your important input can be read by some other window anyway.
This is a totally different issue; Wayland gives up the ability to provide user-aid that prevents an obvious human error. This is not really a security issue, it is a usability issue that can just happen to allow a user to make a security slip-up.

In exchange, Wayland gains… well, nothing really, the idea is that it’ll protect users from malicious programs peeking at other windows on their computer. But in that case situation is already FUBAR, there’s no way to protect a computer that is already running attacks locally on itself.

The idea is that to worry about security in something broken by design is a folly.
Right, the idea of running hostile programs on your system is broken by design, Wayland is engaging in folly by trying to protect against it. X11 gives up that pointless quest and, by doing so, at least it can provide some extra user-assistance features (including ones that can help mitigate security related user errors).
Are you posting from seL4, OpenBSD, or Genode?
>> Occasionally, I've enjoying playing around with window management and hacking with WMs, using stuff like this and/or xdotool and wmctrl.

Ydotool readme:

> Currently implemented command(s):

> type - Type a string

> key - Press keys

> mousemove - Move mouse pointer to absolute position

> click - Click on mouse buttons

So... No.

For what xdotool does - pretty much a substitute. For anything else you need a compositor specific tool.

KWin scripts or something might work for KDE: https://develop.kde.org/docs/plasma/kwin/

> For what xdotool does - pretty much a substitute.

No; for just the input functions, and that only if you're not using `--window`, it's a substitute. But xdotool is a lot more than that.

> For anything else you need a compositor specific tool.

Yes, exactly. For the things that were asked for, your best hope is do see if your particular compositor deigned to provide the API surface, and then if it did, write something that uses those non-portable APIs to do what you want.

Makes perfect sense for it to be something that interacts with the compositor. So KWin does expose such API. But that's not part of Wayland itself or its protocols.

Want to make it easy? Use KDE which cares about flexibility and write scripts for it. Otherwise - probably tough luck, not sure how much other compositors even care about such things.

Or I could just use X11, where this is a solved problem using a single API that works on arbitrary window managers / desktop environments. The only problem is people keep showing up to tell me that I need to stop using it and use their feature-poor alternative.
You couldn't really since it's DOA. Otherwise you'd be stuck with unsupported path.