{"record":{"id":"2c833dcb94719d36","repo":"Hmbown/CodeWhale","slug":"cursor-position-needs-an-x11-session-in-this-build","errorCode":null,"errorMessage":"cursor position needs an X11 session in this build","messagePattern":"cursor position needs an X11 session in this build","errorType":"exception","errorClass":"ExecError","httpStatus":null,"severity":"warning","filePath":"crates/tui/plugins/computer-use/src/backends/linux.mjs","lineNumber":768,"sourceCode":"    },\n    write_clipboard: async ({ text }) => {\n      await probeSession();\n      const cmd = session === \"x11\"\n        ? (tools.xclip ? [\"xclip\", \"-selection\", \"clipboard\"] : [\"xsel\", \"--clipboard\", \"--input\"])\n        : [\"wl-copy\"];\n      need(cmd[0], \"clipboard write\");\n      spawnDetached(cmd[0], cmd.slice(1), String(text ?? \"\"), true);\n      return { written: String(text ?? \"\").length };\n    },\n    cursor_position: async () => {\n      await probeSession();\n      if (session === \"x11\") {\n        const out = await xdotool([\"getmouselocation\"]);\n        const m = /x:(-?\\d+)\\s+y:(-?\\d+)/.exec(out);\n        if (!m) throw new ExecError(`could not parse xdotool getmouselocation output: ${out}`);\n        return { x: Number(m[1]), y: Number(m[2]) };\n      }\n      throw new ExecError(\"cursor position needs an X11 session in this build\");\n    },\n    recordingStart: async () => {\n      throw Object.assign(new ExecError(\"Recording is unavailable on this platform until the recorder has session-owned cleanup. Use screenshots instead.\"), { code: \"owned_recording_unavailable\" });\n    },\n    recordingStop: async ({ id }) => { throw new ExecError(`unknown recording \"${id}\"`); },\n    recordingStatus: ({ id }) => ({ id, running: false }),\n    recordingList: async () => {\n      const dir = recordingsDir();\n      const out = fs.existsSync(dir)\n        ? fs.readdirSync(dir).filter((f) => /\\.(mp4|mkv|png)$/i.test(f)).map((f) => {\n            const st = fs.statSync(path.join(dir, f));\n            return { file: path.join(dir, f), bytes: st.size, modifiedAt: st.mtime.toISOString() };\n          }).sort((a, b) => b.modifiedAt.localeCompare(a.modifiedAt)).slice(0, 50)\n        : [];\n      return { dir, recordings: out, running: [] };\n    },\n  };\n","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/src/backends/linux.mjs#L750-L786","documentation":"cursor_position is only implemented for X11 in this backend build. On Wayland sessions the handler falls through to a throw saying an X11 session is required. This is a deliberate fail-closed limit, since Wayland intentionally blocks global pointer-position queries from clients.","triggerScenarios":"Calling cursor_position while probeSession detected a Wayland session (wl-* tooling) rather than X11.","commonSituations":"GNOME/KDE Wayland desktops (the default on modern distros); apps forced onto Wayland via environment variables; hybrid setups where the app sees XWayland but the session reported Wayland.","solutions":["Log in with an 'Xorg' session (GNOME on Xorg, Plasma X11) if cursor position is required","Read the cursor via a Wayland-native route, e.g. an overlay/compositor extension or `dotool`/compositor-specific IPC","Skip cursor-position features on Wayland and use screenshot+coordinate workflows instead"],"exampleFix":"// before\nconst pos = await backend.cursor_position();\n// after\nconst session = await detectSession();\nconst pos = session === 'x11' ? await backend.cursor_position() : null; // unsupported on Wayland","handlingStrategy":"validation","validationCode":"if (sessionType !== 'x11') throw new SkipError('cursor_position requires X11; session is ' + sessionType);","typeGuard":"const supportsCursorPosition = (backend) => backend.session === 'x11';","tryCatchPattern":null,"preventionTips":["Detect the session type (X11 vs Wayland) before advertising cursor features","Gate cursor-position capabilities in capability discovery","Prefer Xorg sessions in automation environments"],"tags":["wayland","x11","unsupported-platform","cursor","linux"],"backgroundTag":"unsupported-platform","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T21:17:16.096Z"}