Skip to content

CLI: allow disabling mouse capture independently of alternate-screen mode #48664

Open

Description

@Prgebish

What variant of Codex are you using?

CLI, codex-cli 0.157.1.

What feature would you like to see?

A supported option to disable Codex's mouse capture independently of alternate-screen/fullscreen mode, so the enclosing terminal or multiplexer can handle selection and copy-on-select.

I use Herdr with ui.copy_on_select = true. Ordinary left-button drag selection should remain owned by Herdr and copy the selected text when the button is released, without requiring Shift or an additional copy shortcut. Inside fullscreen Codex, mouse events are forwarded to Codex instead, so Herdr's copy-on-select does not run.

Reproduction:

  1. Run Herdr 0.9.1 inside kitty on Linux, with Herdr's mouse capture and copy-on-select enabled.
  2. Start Codex CLI 0.157.1 in a pane using its default alternate-screen mode.
  3. Drag-select transcript text with the mouse or touchpad, without holding Shift, and release.
  4. Herdr does not perform its configured copy-on-select action.

Please allow users to retain the fullscreen interface while leaving mouse gestures to the enclosing terminal/multiplexer. Losing Codex-specific mouse interactions would be an acceptable tradeoff when explicitly choosing this option.

Additional information

Environment: Arch Linux x86_64, Niri/Wayland, kitty 0.49.1, Herdr 0.9.1, Codex CLI 0.157.1.

Startup output captured in isolated PTYs on this installation showed:

  • Default Codex enabled mouse modes 1000, 1002, 1003, and SGR mouse encoding 1006.
  • With --no-alt-screen, those mouse modes were not enabled.
  • With -c 'tui.alternate_screen="never"', those mouse modes were also not enabled.

These checks verified startup terminal control sequences, not an end-to-end clipboard test of the workaround. Herdr 0.9.1's mouse handler forwards left-button gestures to a pane when the pane requests mouse reporting, rather than starting Herdr's own selection.

Disabling alternate-screen mode is a workaround, but also changes the display/scrollback workflow. Shift-selection uses the outer terminal's selection instead of Herdr's. Neither provides the requested combination of fullscreen Codex and Herdr-owned ordinary drag-to-copy.

Related reports: #48139 (CLI copy/paste behavior on Debian) and #47469 (fullscreen mouse capture intercepting Windows Terminal right-click paste). This request specifically concerns an opt-out from mouse capture without leaving fullscreen mode.

Activity

  1. added
    enhancement
    CLI
    TUI
    on Sep 27, 2026
  2. lwmacct commented on Sep 28, 2026

    @lwmacct

    A tmux mouse on workflow needs this separation as well.

    With tmux configured to own ordinary drag selection and copy through MouseDragEnd1Pane, 0.157.x fullscreen mode enables mouse reporting and causes tmux to forward drags to Codex. The tmux copy path therefore never runs. --no-alt-screen restores it, but it also changes the display/scrollback model.

    For tmux, mouse on is not consent for the child application to capture pointer events; it often explicitly means tmux should mediate copy-mode and selection. A setting that leaves fullscreen rendering enabled while suppressing Codex mouse reporting would preserve the terminal/multiplexer contract. Losing Codex-specific mouse interactions under that setting would be an acceptable tradeoff.

  3. lwmacct commented on Sep 28, 2026

    @lwmacct

    I'd frame this as separating transcript rendering from input ownership.

    The current workaround works:

    [tui]
    fullscreen_transcript = false

    For a tmux session with mouse on and drag-select/copy bindings, this restores the previous terminal/multiplexer path. However, it also forces users back to the scrollback UI rather than solving the actual input-ownership problem.

    A useful API might be:

    [tui]
    fullscreen_transcript = true
    mouse_reporting = "never"

    Possible values could be:

    • auto: current behavior, including the existing tmux detection.
    • always: explicitly request Codex-managed mouse reporting.
    • never: never enable mouse reporting, leaving selection, wheel, and other mouse gestures to the enclosing terminal or multiplexer.

    With never, Codex should not emit ?1000h, ?1002h, ?1003h, or ?1006h, including when entering fullscreen or overlays. Codex-managed selection, copy-on-select, right-click paste fallback, and link hover would naturally be unavailable; that is an acceptable tradeoff when the user explicitly chooses terminal/multiplexer ownership.

    This would particularly help tmux users because set -g mouse on often means tmux is intentionally responsible for selection and copy-mode. Right now Codex receives the drag events, so MouseDragEnd1Pane and the user's copy path never run.

    Suggested acceptance criteria:

    1. fullscreen_transcript = true can be combined with disabled mouse reporting.
    2. No mouse-reporting escape sequences are emitted in that mode.
    3. Overlay transitions do not re-enable mouse reporting.
    4. Existing auto behavior remains unchanged.
    5. A tmux integration test covers mouse on plus drag-selection ownership.
    6. Documentation explains which Codex mouse features are lost when reporting is disabled.
  4. gardner commented on Sep 29, 2026

    @gardner

    It is frustrating to have copy / paste hijacked in a remote terminal window. It means the copy / paste functionality doesn't work.

    EDIT: looks like it broke ⌘-click to open URLs in my browser. This used to work with remote sessions. Cmd-click a URL on the remote session terminal and it would open on my local desktop browser.

  5. entomb commented on Sep 30, 2026

    @entomb

    Seeing this on Codex CLI 0.159.2 as well. I want to keep the fullscreen/alternate-screen UI, especially the sticky input bar and other fullscreen features, while letting my terminal emulator or multiplexer own text selection and clipboard handling.

    Codex capturing selection breaks normal copy-paste, particularly over SSH or inside Herdr, where copying inside Codex does not reliably reach the client clipboard.

    I tried tui.copy_on_select = "never", but that did not restore terminal-owned selection and copying. Setting tui.alternate_screen = "never" is the workaround, but it sacrifices the fullscreen UI I want to keep.

    Please provide an independent option to disable Codex mouse capture while retaining fullscreen rendering. Rendering mode and selection/clipboard ownership should be separate choices.

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

    CLITUIenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions