Recordly icon indicating copy to clipboard operation
Recordly copied to clipboard

[Bug]: Cursor following not working on linux

Open truekas opened this issue 8 months ago • 15 comments

Search existing issues

  • [x] I have searched the existing issues

Describe the bug

Cursor following does not work on linux. Sometimes the cursor does move but it's very very random and only a little bit, i attached a video below. I am on arch using wayland on KDE.

recording-1773603130756.webm.cursor.json https://github.com/user-attachments/assets/f27df72b-e6de-41da-93ea-888d1ec9f029

Expected behavior

I expect for the cursor to follow.

To Reproduce

Record on linux.

Screenshots

No response

OS

Linux

OS Version

Arch Linux

Other OS

No response

Additional context

No response

truekas avatar Mar 15 '26 19:03 truekas

Same here, i am using Fedora.

stephanto-dev avatar Mar 15 '26 20:03 stephanto-dev

same issue, they said "Linux currently use Electron's capture path, which means the OS cursor cannot always be hidden during recording." so i think is the reason why but idk lmk if this can be fixed

ferdianfariza avatar Mar 16 '26 03:03 ferdianfariza

fix(linux): restore cursor follow with linux bounds + hook mouse cache

Let me know if this changes anything

still doesn't look like it is fixed. i am on two monitors, does that change anything? i notice when i move between monitors the cursor moves a little. after submitting this comment i will try on 1 monitor

https://github.com/user-attachments/assets/4ffaeef8-6304-4773-8058-b5ac4545bce9

truekas avatar Mar 16 '26 20:03 truekas

Still didn't work, but found something very useful. The cursor only moves when my mouse is over the recordly window. See the attached video.

https://github.com/user-attachments/assets/2a5113d8-ec8c-437f-b604-4cb748e56f28

truekas avatar Mar 16 '26 20:03 truekas

That is useful info, thank you

webadderall avatar Mar 16 '26 23:03 webadderall

Does the issue still happen?

webadderall avatar Mar 24 '26 08:03 webadderall

On v1.1.4, yes. I'll try the latest one tonight

truekas avatar Mar 24 '26 13:03 truekas

Still the same issue, it only works when I'm hovering over the window. Additionally when I try to share an entire monitor it says it is not available for browser capture on this system despite having worked in previous versions. Windows still work though.

truekas avatar Mar 25 '26 03:03 truekas

Update: several Linux/Wayland commits landed on main after the last test on v1.1.4:

  • 646dcf9 ("fix: cursor DPI normalization for Windows/Linux scaled displays") — cursor-position related.
  • 571bbb9 ("fix(linux/wayland): collapse 3-step capture flow into a single portal dialog") — Wayland capture flow restructure.
  • fa97c94 ("fix(linux): allow full-screen capture by matching display sources by position if IDs do not match") — addresses the secondary "entire monitor not available for browser capture" symptom you also reported.

If the cursor-only-moves-while-hovering-Recordly pattern still reproduces on current main after those, that confirms the cursor path is separate from the capture/portal issues and worth keeping open as its own bug.

meiiie avatar Apr 24 '26 19:04 meiiie

this is not really possible under wayland btw, you can only track cursor positions of your own window or window that is being recorded (with pipewire), and tracking cursor under pipewire screencast (which electron uses) is broken under most compositors. implementing follow cursor under wayland globally requires some advanced dirty hacks.

martian0x80 avatar May 25 '26 12:05 martian0x80

this is not really possible under wayland btw, you can only track cursor positions of your own window or window that is being recorded (with pipewire), and tracking cursor under pipewire screencast (which electron uses) is broken under most compositors. implementing follow cursor under wayland globally requires some advanced dirty hacks.

Thank you for your feedback, it's really helpful. Do you have any feasible solutions to suggest?

meiiie avatar May 25 '26 13:05 meiiie

On Wayland uiohook only sees XWayland clients, so the telemetry gets no pointer motion or clicks from native Wayland windows; that is why the cursor only twitches occasionally. #863 adds a Wayland path that reads the pointer from Hyprland's IPC socket and buttons from /dev/input (user must be in the input group). KDE and GNOME still have no pointer-position source after that PR, since neither exposes a global cursor position; leaving this open for them.

Nuu-maan avatar Sep 02 '26 18:09 Nuu-maan

this is not really possible under wayland btw, you can only track cursor positions of your own window or window that is being recorded (with pipewire), and tracking cursor under pipewire screencast (which electron uses) is broken under most compositors. implementing follow cursor under wayland globally requires some advanced dirty hacks.

Thank you for your feedback, it's really helpful. Do you have any feasible solutions to suggest?

i have actually worked on this before, it took a fair bit of experimentation,

  1. if you are capturing through kms (kernel modesettings), you can grab the cursor plane and add your own motion effects on it (without needing the global pos).
  2. i wrote a workaround for this using libinput delta tracking (libinput can only stream motion deltas instead of positions) and layer shell (zwlr_layer_shell_v1) anchoring. creating an active-input transparent layer shell surface steals events and prevents mouse events from passing through the surface, so you have to repeatedly spawn/close the surface (by spawn/close i mean, collapse/expand the input region) around the last best known estimation of the cursor and anchor the position while streaming and accounting for the motion deltas from the libinput context for the device node. a working implementation is here, a part of my gpu accelerated screen recorder. although, this is annoying and i would probably avoid this since this requires elevated privileges (or special caps).

martian0x80 avatar Sep 02 '26 20:09 martian0x80

Confirming the same behaviour on Kubuntu 26.04.1 LTS / KDE Plasma 6.6.6 (KWin Wayland), Recordly 1.3.3 AppImage, Electron 39.2.7. Adding measurements, since this thread is mostly Arch so far and the KDE data point may help.

Evidence from a real recording (recording-*.webm.cursor.json, 9.7 s)

Metric Value
Telemetry samples 293 (~30 Hz polling, so the poller itself runs fine)
Distinct cursor positions 14
Longest run of identical positions 242 samples (~8 s)
interactionType values move only, 0 clicks
Video frames actually written last packet at 3.16 s of a 9.7 s recording

Position only changes while the pointer is over a Recordly window, exactly as @truekas observed. Clicks are never recorded, so auto-zoom has nothing to work with.

What the process logs at hook start

[CursorTelemetry] hook loaded: true has.on: function has.start: function
hook_thread_proc [101]: Could not set thread priority 49 for thread ...
load_input_helper [1827]: XkbGetKeyboard failed to locate a valid keyboard!

and KWin's Xwayland side at the same instant:

kwin_wayland_wrapper: syntax error: line 1 of stdin
kwin_wayland_wrapper: Errors encountered in stdin; not compiled.

So uiohook attaches to Xwayland and, as @Nuu-maan said, only ever sees XWayland clients. screen.getCursorScreenPoint() is no help either: on Wayland Chromium can only return the last pointer position delivered to its own surfaces.

For completeness: during the same session the main process died once with SIGSEGV ~32 s after the hook started (systemd-coredump, dump truncated so no usable backtrace). I can't attribute it to uiohook with certainty, so treat it as anecdotal.

A portal-sanctioned source for KDE/GNOME that #863 does not cover

The Hyprland IPC path in #863 has no equivalent on KDE or GNOME, but both already ship the one legitimate Wayland channel for global cursor position: the ScreenCast portal cursor mode metadata. On this machine:

$ busctl --user get-property org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop \
    org.freedesktop.portal.ScreenCast AvailableCursorModes
u 7      # hidden | embedded | metadata

With cursor_mode = 4 the compositor keeps the cursor out of the frames (which also fixes the double-cursor problem on Linux) and attaches its position per buffer as SPA_META_Cursor. Chromium's PipeWire capturer already requests this mode internally but never exposes the position to the app. A native PipeWire capture backend (the same idea as the x11grab backend in #842, but portal + PipeWire instead) would get clean frames and an accurate global cursor track in one stream, on every compositor that implements the portal. Clicks would still need a separate source (evdev with the input group, as in #863), but position is the part that currently makes the feature unusable.

Happy to test a build on Plasma 6.6 if that direction is taken.

selter2001 avatar Sep 03 '26 14:09 selter2001