RockyCott
RockyCott

Reputation: 59

Clipboard paste not working in VS Code after copying from Chromium-based browsers

I am experiencing an issue with Visual Studio Code. When I try to paste text into VS Code after copying from certain browsers and applications, the paste operation does not work as expected.

Details

Steps to Reproduce

  1. Open a Chromium-based browser (e.g., Microsoft Edge, Google Chrome, Vivaldi) and select some text.
  2. Copy the text using Ctrl+C.
  3. Switch to Visual Studio Code and attempt to paste the copied text into an open file using Ctrl+V.

Expected Result

The copied text should be pasted into the file in Visual Studio Code.

Actual Result

Nothing is pasted when pressing Ctrl+V in VS Code if the text was copied from a Chromium-based browser. However, when checking the clipboard history with Windows+V, the text is visible and selecting it from the clipboard allows it to be pasted into VS Code.


What I've Tried

The issue does not occur when pasting into other applications or when the text is copied from Firefox. I have also tried copying from the Obsidian app and encountered the same issue.

Question

Has anyone else experienced this issue or does anyone have suggestions for potential solutions or workarounds?

video demonstration of the issue showing the steps and the behavior I am encountering.

Upvotes: 2

Views: 3237

Answers (2)

Doman
Doman

Reputation: 98

Unbinding paste from Keyboard Shortcuts fixes this problem for me.

Related GH issue: https://github.com/microsoft/vscode/issues/238609#issuecomment-2611147382

Arch, Hyprland, VSCode v1.97.0

This problem should be resolved in VSCode v1.98: https://github.com/microsoft/vscode/pull/237557

Upvotes: 0

RockyCott
RockyCott

Reputation: 59

I found a "solution" to my issue with copy-pasting text.

The file ~/.config/code-flags.conf contained the following lines:

--ozone-platform-hint=wayland

--disable-gpu

By removing the line --ozone-platform-hint=wayland, the copy-paste functionality started working again as expected. VSCode now runs under XWayland instead of natively on Wayland, which seems to solve the problem.

Switching VSCode to run under XWayland resolved the clipboard issues. It appears that the configuration forcing VSCode to use Wayland was causing the problem.

Upvotes: 0

Related Questions