robiot / xclicker

XClicker - Fast gui autoclicker for x11 linux desktops
https://xclicker.xyz
GNU General Public License v3.0
480 stars 42 forks source link

Native mode #25

Open robiot opened 2 years ago

robiot commented 2 years ago

A mode that uses uinput to send mouse events. This will work in wayland, but probably require root.

robiot commented 2 years ago

Maybe have a daemon running that handles all virtual input stuff?

robiot commented 2 years ago

This would be very complicated since almost everything builds on X's apis. :\

nm004 commented 2 years ago

Hi @robiot. Thank you for your great work :+1:

I have news for you.

There are two wayland protocol extensions to get the state of input device (zwlr_virtual_pointer_v1, org_kde_kwin_fake_input), but they are compositor specific protocols (wlroots and KDE). There is another emulated input library called libei. But libei is still WIP, and needs an emulated input sever in wayland compositor. Currently, only GNOME has implemented it, but the commit has not yet be merged (https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1436).

Uinput is another option, though it requires root permission (more precisely, read/write permissions for /dev/uinput and read permission for /dev/input/event*). Unfortunately, it has ~30hz rate limit for clicking. It is becuase libinput manages inputs and it looks like dealing with button bouncing.

Working virtual input in wayland is still a long way to go...

robiot commented 2 years ago

Hi @robiot. Thank you for your great work +1

I have news for you.

There are two wayland protocol extensions to get input devices' state (zwlr_virtual_pointer_v1, org_kde_kwin_fake_input), but they are compositor specific protocols (wlroots and KDE). There is an another emulated input library called libei. But libei is still WIP, and needs an emulated input sever in wayland compositor. Currently, only GNOME has implemented it, but the commit is still not be merged (https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1436).

I wrote a auto click program using uinput (https://gist.github.com/nm004/e34b40ef3c2ab3ab8ec3eab2376ca7ab). It requires root, of course (set read/write permission for /dev/uinput and set read permission for /dev/input/event*). My program works well for my needs, but it has ~30hz rate limit for clicking. It is becuase, in wayland, (mostly) libinput manages inputs and it deal with button bouncing (I'm not 100% sure, sorry). My program simulates clicking with an uinput device, so the click events are handled by libinput.

Working virtual input in wayland is still a long way to go...

Yep, it's sad that there isn't a nice way to do it, like you can in X. I looked into libei and it seemed kinda nice. But XClicker don't just send clicks. It also has the hotkey listener, mouse position chooser and hotkey chooser which all use X's APIs.

I think the easiest thing to do here, would be to create a daemon, xclickerd or something, that provides the functionality to simulate mouse clicks and get key/mouse presses.

twisted-nematic57 commented 1 year ago

I need this. GDM is being stubborn and refuses to boot into Xorg mode.

wolf-yuan-6115 commented 1 year ago

Screencast from 2023-01-03 18-46-46.webm Hmm Xclicker on Wayland is working for me

KotoWhiskas commented 1 year ago

Screencast from 2023-01-03 18-46-46.webm Hmm Xclicker on Wayland is working for me

Because both XClicker and Brave use xwayland