feschber / lan-mouse

mouse & keyboard sharing via LAN
GNU General Public License v3.0
2.6k stars 81 forks source link

Windows -> Wayland (Sway) Modifier Keys not registering #204

Open Vassili-Dev opened 1 month ago

Vassili-Dev commented 1 month ago

When running Windows + Sway:

Windows -> Sway: Modifier+Key only seems to register Key (Can't use Sway Shortcuts, Can't do ^C, etc) Sway -> Windows: Works as expected

Windows

Sway

Logs: LanMouseLog_Sway.txt LanMouseLog_Windows.txt

Vassili-Dev commented 1 month ago

I won't pretend to know how this works, so please take this with a bucket of salt, but I suspect it has to do with to_key_event not generating KeyboardEvent::Modifiers.

https://github.com/feschber/lan-mouse/blob/b071201dcb000a09330df81784d2ef2c0446da90/input-capture/src/windows.rs#L184-L225

feschber commented 1 month ago

Yeah, I hinted at this in the README: "Gnome -> Sway only partially works (modifier events are not handled correctly)" This is a bit of a lie, as it does not only apply to GNOME but technically anything but Sway at this point, as you have realized.

You are totally right about the to_key_event function, however I think it's ultimately better to generate the Modifiers event on the client side rather than on every capture backend (this would need to be added to the input-capture-portal backend as well for example). The wlroots backend is the only backend that actually needs modifier events as far as I remember.

Unfortunately I have not found the time to implement this yet but its definitely a priority once the encryption stuff is done :)