this post was submitted on 11 Jul 2026
12 points (100.0% liked)

Linux

66826 readers
43 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS
 

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

top 13 comments
sorted by: hot top controversial new old
[–] ISOmorph@feddit.org 4 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

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 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

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 because when the mouse is at the edge of the screen it scrolls the view which is really annoying.

[–] ISOmorph@feddit.org 1 points 3 weeks ago

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

[–] Zamundaaa@discuss.tchncs.de 2 points 3 weeks ago

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 points 3 weeks ago (1 children)

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 2 points 3 weeks ago (1 children)

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 points 3 weeks ago

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.

[–] regdog@lemmy.world 1 points 3 weeks ago (1 children)

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 points 3 weeks ago (1 children)

Just semi automatic, I want a hotkey press activate a mouse move -> click -> move action.

[–] regdog@lemmy.world 1 points 3 weeks ago

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