Skip to content

[Bug]: Middle-click paste ignores the system setting that disables it on Linux (gtk-enable-primary-paste) #26150

Closed

Description

@LukasKH

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. On Linux, turn off middle-click paste system-wide:
    gsettings set org.gnome.desktop.interface gtk-enable-primary-paste false
  2. Restart T3 Code.
  3. Select or copy some text, then middle-click in the composer.

Expected behavior

Nothing is pasted. Regular Chromium (144+) and GTK apps follow this setting.

Actual behavior

The selected text is pasted into the composer. T3 Code is the only app on my system that still pastes on middle click with this setting off.

Cause

Chromium 144 made middle-click paste follow the desktop setting. LinuxUi::PrimaryPasteEnabled() reads gtk-enable-primary-paste from GTK. Chrome copies the result into the renderer in chrome/browser/renderer_preferences_util.cc:

prefs->middle_click_paste_allowed = linux_ui->PrimaryPasteEnabled();

That file belongs to Chrome, not to content/, so Electron doesn't use it, and Electron never sets blink::RendererPreferences::middle_click_paste_allowed. The field defaults to true, so Blink always pastes on middle click in Electron apps, whatever the system setting says.

Two possible fixes:

  • In T3 Code: on Linux and BSD, check the setting from the main process, either with gsettings or through the org.freedesktop.portal.Settings portal. When it's off, preventDefault the middle-button mouseup everywhere. This is the same trick surface.ts already uses for the terminal (isMiddleClickPastePlatform()), and the fix in fix(web): middle-click closing a panel tab no longer pastes the primary selection #18860 used it for panel tabs.
  • Upstream: ask Electron to set middle_click_paste_allowed from LinuxUi the way Chrome does.

Related: #15531 (stray paste when middle-clicking the timeline) and #15939 (stray paste when middle-click closing a tab). In both, the user wants middle-click paste to work in general. This issue covers users who have turned it off everywhere.

Impact

Minor bug or occasional failure

Version or commit

0.1.2 (Arch package t3code 0.1.2-1)

Environment

Arch Linux (Omarchy), Hyprland 0.56.2 on Wayland, Electron 44.9.3 / Chromium 152. Hyprland misc:middle_click_paste = false is also set, which stops paste between apps but not inside a Chromium or Electron app.

Workaround

None found. Chromium itself respects the setting, but T3 Code doesn't.

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