Pen stylus: stray line at the start of every stroke on native Wayland KDE Plasma (not a problem under XWayland)

Steps to reproduce

  1. Install latest obsidian app image (mine is 1.14.4)
  2. Run Obsidian natively on Wayland (–ozone-platform=wayland).
  3. Open an Excalidraw drawing (or any other drawing extension).
  4. Touch the pen to the screen and draw.

Did you read and follow the Troubleshooting Guide? Yes

Expected result

the stroke starts exactly where the pen touches.

Actual result

A short line appears from the old pointer position to the touch point.

Environment

SYSTEM INFO:
Obsidian version: 1.14.4
Installer version: 1.14.4
Operating system: #1 SMP PREEMPT_DYNAMIC Sat, 03 Oct 2026 11:43:28 +0000 7.2.9-arch1-1
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 7
Plugins enabled: 1
1: Excalidraw v2.28.1

  • Arch Linux, KDE Plasma 6.7.5 on Wayland (KWin 6.7.5)
  • libinput 1.32.0
  • Intel 2-in-1 with touchscreen; pen: “Wacom HID 48E4 Pen” (i2c 056a:48e4)
  • Obsidian 1.14.4, tested with Electron 43.7.6 (pacman), 43.3.0 (AppImage) and 44.6.0 (system Electron)
  • Plugin: Excalidraw v2.28.1; pen mode on/off made no difference

Additional information

What I checked

  • libinput list-devices shows the pen as “tablet”, no acceleration profile, identity calibration. debug-events shows high-rate events arriving normally.
  • Rnote on native Wayland with the same pen, KWin and libinput draws clean strokes, so the system side seems fine.
  • With --ozone-platform=x11 (XWayland), strokes are clean, but the side buttons arrive as plain mouse buttons, so eraser and right click change behaviour.
  • Display scaling is correct and isn’t the cause.
  • Flags with no effect: --enable-features=UseOzonePlatform, --touch-events=enabled, --ozone-platform-hint=auto, TouchTextEditingRedesign, WebTouchEvent.
  • Excalidraw on firefox: works perfectly fine with no issues

My guess
In native Wayland mode the pen seems to arrive in Electron as an emulated mouse pointer, not through the tablet protocol (that Rnote uses), so the stroke starts from a lagging pointer position.

As explained in the bug report template:

  • We don’t take bug reports when third-party (un-authorized) repackaging of obsidian is used.
  • We don’t take bug reports involving third-party plugins.

That being said, this seems and electron/wayland problem, so you’ll have to wait until this thing is addressed upstream.

Does this problem happen in Excalidraw on Chrome?

I have used the latest appimage listed on the official obsidian webpage, and upon more investigation I found it’s because pendown pen event has a delayed position.
Okay, I understand this is only replicable with third-party plugins.

Am I allowed to further explain the problem and provide the (temporary) solution for it for people that have the same issue before it gets officially fixed on electron? Or create a plugin to specifically fix this for anyone that has this specific issue?

Thank you. And sorry for missing the points in the template.

Yes, sure!

Alright, after further investigation, I found out that my stylus does these steps:

  1. recognises pendown event with a position
  2. sends a penmove event with a correct position
  3. might send one more penmove event with an even more precise position

because it starts pendown at a different location (a delayed position), it draws a weird line on the start.

I was able to use javascript to catch the pendown event, and relay it with a newer mouse position, that fixed my issue, I also put it into a plugin but I don’t think many people have this issue, therefore a simple code fix is fine.

function installStylusFix(win = window, skipMoves = 0) {
  let held = null;
  let skipped = 0;

  const makeDown = (src, pos) =>
    // sorry, this just copies all the parameters from the last event to this new one
    new win.PointerEvent("pointerdown", {
      bubbles: true, cancelable: true, composed: true, pointerId: src.pointerId, pointerType: src.pointerType, isPrimary: src.isPrimary, button: src.button, buttons: src.buttons, pressure: src.pressure || pos.pressure, tangentialPressure: src.tangentialPressure, tiltX: src.tiltX, tiltY: src.tiltY, twist: src.twist, width: src.width, height: src.height, ctrlKey: src.ctrlKey, shiftKey: src.shiftKey, altKey: src.altKey, metaKey: src.metaKey, clientX: pos.clientX, clientY: pos.clientY, screenX: pos.screenX, screenY: pos.screenY
    });
  // fixed with a correct position
  const replay = (pos) => {
    const src = held;
    held = null;
    src.target.dispatchEvent(makeDown(src, pos));
  };
  
  const handlers = {
    pointerdown: (e) => {
      if (e.pointerType !== "pen" || !e.isTrusted) return;
      held = e;
      skipped = 0;
      e.stopImmediatePropagation();
    },
    // discard one or more moves, then replay the touch-down
    pointermove: (e) => {
      if (!held || !e.isTrusted || e.pointerId !== held.pointerId) return;
      if (skipped < skipMoves) { skipped++; e.stopImmediatePropagation(); return; }
      replay(e);
    },
    // edge cases
    // a tap with no movement
    pointerup: (e) => { if (held && e.isTrusted) replay(e); },
    // Stroke cancelled
    pointercancel: () => { held = null; },
  };

  Object.entries(handlers).forEach(([t, f]) => win.addEventListener(t, f, true));
  // a way to stop it
  return () => Object.entries(handlers).forEach(([t, f]) => win.removeEventListener(t, f, true));
}

const stop = installStylusFix(); // you can call stop() to undo

Thanks and hope this helps to anyone in the future!

Hey, I have the exact same issue and I searched like 3 days until I came across this post.
I do think this is quite relevant cause it basically prevented me from using my pen.
Do you have said extension publicly available by chance?
Also do you know if this is actually being worked on by electron or chromium?

Yeah, sorry for replying so late. I have created a plugin for it and I’ve been using it for the past month, no issues so far.

here is the link: GitHub - MiraDuck/Stylus_Wayland_Fix: An extension to fix the stray line at every press of the stylus. It is a simple javascript fix that holds back the pendown event until you actually move the pen. · GitHub

I believe this is not being worked on by chromium since it’s a pen handling issue specifically on wayland. I’ve looked at past versions of it, and I haven’t seen any progress regarding the issue.