Skip to content

GNOME Wayland: let Computer Use click without moving my mouse #480

Closed

Description

@Ondra-Zik

When Codex clicks in one window, my cursor jumps to wherever it clicked. I can put Chromium on one monitor and work on the other, but we still fight over the same pointer. If I’m about to click something when Codex moves it, my click can land in the wrong window. I’d like Codex to keep its own pointer position so I can keep using my mouse.

I noticed my graphics tablet and mouse could point at different places on GNOME Wayland. So I asked Codex to emulate a tablet. No physical tablet needed.

  • How it works — A temporary uinput pen maps to the target monitor. The backend checks window focus and bounds before sending pen events. A virtual touchscreen handles scrolling.
  • Tested — NixOS, GNOME Wayland, backend 0.7.53. Hover, drag, right-click, middle-click, double-click, and four scroll directions passed in both Wayland and XWayland Chromium. My mouse stayed put in all 18 checks. I also moved it on one monitor while Codex selected text on the other.
  • Limits — Keyboard focus is still shared. Drag stays within one window and monitor. Scrolling requires touch panning. Hover lasts up to eight seconds.

Would you be open to an opt-in virtual pen for GNOME Wayland? Happy to share the prototype and test steps(The prototype is fully vibecoded :D )

Activity

  1. avifenesh commented on Nov 19, 2026

    @avifenesh
    Collaborator

    Hi, thanks. I'll check it, but I recommend agent-sh/agent-workspace-linux, this is essentially what you are looking for.

  2. avifenesh commented on Nov 20, 2026

    @avifenesh
    Collaborator

    Thanks @Ondra-Zik. Your pen idea and the test plan behind it shipped, and they led to a keyboard counterpart.

    Releases: v0.7.57, v0.7.58, v0.7.59.

    Pointer (v0.7.58, v0.7.59). click, drag and scroll take delivery: "background" with a window target. On GNOME Wayland and on KDE Plasma Wayland (KWin 6.3 and later) they go through a virtual pen and a virtual touchscreen, so your mouse stays where it is. Left click is a pen tap. Right and middle click are the barrel buttons. A drag is a pen stroke. A scroll is a one-finger touch pan. Before any input the server checks that the point is on the target window and that nothing covers it. A locked screen, the Overview, Show Desktop or a covered point refuses the call, and nothing is sent. Results name the route (gnome-pen, gnome-touch, kwin-pen, kwin-touch) and say whether keyboard focus moved. doctor reports it in capabilities.background_pointer.

    v0.7.59 fixes what you saw in Chromium. GNOME 48 changed the stylus button defaults, so right and middle came out swapped. The server now sets the button actions for its own pen. It also stopped the 8 s hover, which made libinput drop touch scrolls after a click.

    Limits:

    • It is opt-in. Apps without tablet support never see the pen, and the call cannot tell, so the uinput pointer stays the default.
    • A tap or a touch focuses the window it lands on, so your typing goes there afterwards. The result says when that happened.
    • A drag stays inside one window. A scroll works only where the app pans on touch.
    • Other compositors move their one cursor for a tablet, so the pen route is GNOME and KWin only.

    Keyboard (v0.7.57). type_text and press_key take delivery: "background" too. An AT-SPI element gets its text and actions directly. A Chromium tab gets them over DevTools when you start the browser with --remote-debugging-port and set COMPUTER_USE_LINUX_DEVTOOLS. A terminal gets them by tty through kitty, wezterm, tmux or screen. On X11 and sway the agent gets its own seat, with its own focus and pointer. Hyprland gets keys through sendkeystate. GNOME has one seat, so whole-window keyboard input there still goes through your focus. The first call that no background route can serve stops and explains why. A retry proceeds with normal input.

    For full isolation on GNOME, run the agent in its own session with agent-workspace-linux.

    One request: please check right and middle click in Chromium on your setup. The fixture passed in Chrome 158 on GNOME 46 with GNOME 48's stylus defaults, but not on your GNOME and NixOS build. If either button comes out wrong, reopen this issue with your GNOME version.

  3. Ondra-Zik commented on Nov 23, 2026

    @Ondra-Zik
    Author

    Confirmed on NixOS, GNOME 51, Chromium 157. Right click opens the context menu, middle click closes the tab. Both work on Wayland and XWayland. Cursor stays put.

    Using the community ChatGPT desktop app. Stock v0.7.59 backend works. Had to patch the desktop bridge so app.click() converts window coordinates to screen coordinates and sends delivery: "background". Is that how clients should opt in, or did I miss a flag?

  4. avifenesh commented on Nov 23, 2026

    @avifenesh
    Collaborator

    Confirmed on NixOS, GNOME 51, Chromium 157. Right click opens the context menu, middle click closes the tab. Both work on Wayland and XWayland. Cursor stays put.

    Using the community ChatGPT desktop app. Stock v0.7.59 backend works. Had to patch the desktop bridge so app.click() converts window coordinates to screen coordinates and sends delivery: "background". Is that how clients should opt in, or did I miss a flag?

    Checking

  5. avifenesh commented on Nov 24, 2026

    @avifenesh
    Collaborator

    Thanks for confirming on GNOME 51.

    Yes, delivery: "background" is the opt-in. There is no other flag. In v0.7.59 a background click needs x and y in screenshot capture pixels with a window target, and the server refuses relative: true with it. So converting in the bridge, as you did, is correct for v0.7.59.

    That conversion belongs in the server, since it already knows the window bounds and the capture scale. The next release accepts relative: true with delivery: "background" on click and scroll. After that the bridge in codex-desktop-linux passes delivery through and keeps sending window coordinates. I'll post here when both are out.

  6. avifenesh commented on Nov 24, 2026

    @avifenesh
    Collaborator

    Released in v0.7.61 (#506). click and scroll now accept relative: true with delivery: "background". The server maps window coordinates to capture pixels and runs the same checks as before: the point must be on the target window and not covered. Clients no longer convert coordinates themselves.

    The bridge in codex-desktop-linux sends delivery: "background" on app.click() and app.scroll() by default (avifenesh/codex-desktop-linux#71, upstream ilysenko/codex-desktop-linux#1714). Your patch can go once that lands in the build you use. Where a desktop has no background route, the first call returns an error asking the agent to repeat it, and the repeat uses normal input. background: false on a call opts out, for apps that ignore pen or touch input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions