Hi,
using Cachyos kde I've been making a python script that will move the mouse to a position -> click -> move mouse back to the original position. I can get this working with x11, but it fails with wayland.
Do you know any way to programatically move the mouse and click that works with wayland?
Thanks
15 Comments
ISOmorph@feddit.org · 7 pts · 47d
ydotool does specifically do what you need. Have a look at their source. Or use it in your python script.
basic_user@lemmy.world · 1 pts · 46d
I've been testing ydotool, but I end up running into this bug
https://github.com/ReimuNotMoe/ydotool/issues/250
Which I can't seem to get around. The workaround to move the mouse to 0,0 and then making non-absolute moves clashes with the game (warcraft 3) because when the mouse is at the edge of the screen it scrolls the view which is really annoying.
I'm going to test input-remapper next.
ISOmorph@feddit.org · 1 pts · 46d
Couldn't you move the mouse to 1920,1080 or whatever your resolution is for the same amount of time to correct the movement? Since you can move the mouse in millisecond speeds it should barely be noticeable
basic_user@lemmy.world · 1 pts · 46d
I did think about moving to an abritary base position and then move from there. The edge of the screen wont work as it will move the view, but any other position could work. I just dont like that I have to make a workaround for basic functionality. I'll try input-remapper and see if it works better. If not I might go back and try this.
basic_user@lemmy.world · 1 pts · 41d
This was a brain fart as the bug specifically prevents absolutte movements so I cannot move the mouse to any specified location. All I can do is move the mouse so much in one direction relatively that it most definitely is at the edge/corner of the screen.
I skipped Input-remapper as the setup for it turned out to be pretty complex and also I need to be able to check current mouse position which it can't.
I have currrently given up on the project.
Zamundaaa@discuss.tchncs.de · 2 pts · 46d
xdotool should work the same in the Wayland session, assuming you give X11 apps the permission to emulate input. What about it isn't working?
edinbruh@feddit.it · 2 pts · 47d
The proper way to programmatically move a cursor on Linux is using
uinput.Anything you were doing that worked in xorg and not in wayland was more akin to a weird remnant from the 80s than to an actual solution.
However, there will likely be full featured applications that already do whatever you were trying to do.
Zamundaaa@discuss.tchncs.de · 3 pts · 46d
uinput is not the proper way, it's emulating a hardware device.
The remote desktop portal is the proper way. Even xdotool works through that.
edinbruh@feddit.it · 2 pts · 46d
Interesting, I didn't know you could do that through the portal directly.
I was only familiar with uinput because I have used it before to use a wiimote as a mouse, and for that you'd actually want to emulate a mouse.
regdog@lemmy.world · 2 pts · 47d
Does it need to be fully automatic, or does semi-automatic work for you?
I am using input remapper to automate a few functions of my input devices. It only used it on my Plasma desktop, but it should work in all desktop environments.
basic_user@lemmy.world · 1 pts · 47d
Just semi automatic, I want a hotkey press activate a mouse move -> click -> move action.
regdog@lemmy.world · 1 pts · 47d
You should be able to do that with input-mapper and some scripting: https://github.com/sezanzeb/input-remapper/blob/main/readme/macros.md#mouse_xy
Tetsuo@jlai.lu · -10 pts · 47d
There is a non-zero chance this post is a cheater asking on how to build a aimbot...
regdog@lemmy.world · 8 pts · 47d
It would be fine either way
basic_user@lemmy.world · 6 pts · 47d
I'm making a hotkey tool for classic warcraft 3 1.27b, so you can calm down.