lan-mouse icon indicating copy to clipboard operation
lan-mouse copied to clipboard

Windows -> Wayland (Sway) Modifier Keys not registering

Open Vassili-Dev opened this issue 1 year ago • 2 comments

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

  • Windows Version: Windows 11 23H2
  • Emulation Backend: windows
  • Capture Backend: windows
  • Frontend: gtk (Also daemonized)

Sway

  • Sway Version: 1.9 (Arch 6.10.10-arch1-1, x86_64)
  • Emulation Backend: wlroots
  • Capture Backend: layer-shell
  • Frontend: gtk (Also daemonized)

Logs: LanMouseLog_Sway.txt LanMouseLog_Windows.txt

Vassili-Dev avatar Sep 22 '24 22:09 Vassili-Dev

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

Vassili-Dev avatar Sep 22 '24 22:09 Vassili-Dev

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 :)

feschber avatar Sep 23 '24 16:09 feschber