JaKooLit / Hyprland-Dots

Hyprland dotfiles - used as main repo for all my Hyprland Install Scripts.
GNU General Public License v3.0
993 stars 127 forks source link

[Bug]: Clipboard Issue: Unable to Copy from Brave to VSCode in Wayland (Hyprland) #430

Closed Linxford closed 1 month ago

Linxford commented 1 month ago

I'm encountering an issue with clipboard functionality when copying text from the Brave browser to VSCode in a Wayland environment (Hyprland). The clipboard works as expected when copying from VSCode to Brave, but not the other way around. Copying from Brave to other applications (e.g., terminal, text editors like Vim) works fine, and clipboard functionality is also fine in Firefox.

Steps to Reproduce:

Running Brave with native Wayland support (--enable-features=UseOzonePlatform --ozone-platform=wayland). Running VSCode in XWayland (default) or with Wayland support (--enable-features=UseOzonePlatform --ozone-platform=wayland). Copy text from Brave and attempt to paste it into VSCode using Ctrl + V or right-click → Paste. Pasting does not work in VSCode. Expected Behavior: Copied text from Brave should be pasteable in VSCode like it works with other applications (e.g., terminal, text editors, Firefox).

Actual Behavior: Pasting does not work in VSCode when copying from Brave.

Environment:

OS: Arch Linux Compositor: Hyprland (Wayland) Brave Version: v128.0.6613.120 VSCode Version: v1.93.0 Clipboard Manager: cliphist is being used for clipboard management. Wayland Protocols: wl-clipboard is installed. Workarounds Attempted:

Using cliphist to manually select and paste from the clipboard history. Running Brave in XWayland mode (--disable-features=UseOzonePlatform). Running VSCode in native Wayland mode (--ozone-platform=wayland). Switching to Firefox resolves the issue, but I prefer using Brave. Additional Notes: This appears to be an issue with how Brave interacts with clipboard management in Wayland environments. The issue persists even when using clipboard managers like cliphist. Clipboard contents from Brave do not seem to be recognized by VSCode.

JaKooLit commented 1 month ago

This is just wayland-electron drama and honestly, I dont have a fix. But I will keep this open in case I can find answer or somebody will chime in later

VitalyyBezuglyj commented 1 month ago

@JaKooLit that was the perfect clarification, thank you! =)

Found a solution here

So you need to find the .desktop entry for your application, mine (fedora) was located at /usr/share/applications/code.desktop and modify

Exec=/usr/share/code/code/code %F.

to Exec=/usr/share/code/code --enable-features=UseOzonePlatform --ozone-platform=wayland %F.

Then do logout-login

P.S. According to the source - this can work for more than just vscode

Linxford commented 1 month ago

Oh nice.... let me try it and give a feedback ☺

JaKooLit commented 1 month ago

thanks for the info.. Pls try and if works, im gonna pin this issue and add to FAQ on the dots wiki

Linxford commented 1 month ago

still not working...............

to be able to paste the text unless i use Win+alt and then select the copied text .........before i can be able to paste it in vscode....

here is the config as i followed the doc above

[Desktop Entry] Name=Code - OSS Comment=Code Editing. Redefined. GenericName=Text Editor Exec=code-oss --enable-features=UseOzonePlatform --ozone-platform=wayland %F // 👉 Icon=com.visualstudio.code.oss Type=Application StartupNotify=false StartupWMClass=code-oss Categories=TextEditor;Development;IDE; MimeType=application/x-code-oss-workspace; Actions=new-empty-window; Keywords=vscode; X-Desktop-File-Install-Version=0.27

[Desktop Action new-empty-window] Name=New Empty Window Name[de]=Neues leeres Fenster Name[es]=Nueva ventana vacía Name[fr]=Nouvelle fenêtre vide Name[it]=Nuova finestra vuota Name[ja]=新しい空のウィンドウ Name[ko]=새 빈 창 Name[ru]=Новое пустое окно Name[zh_CN]=新建空窗口 Name[zh_TW]=開新空視窗 Exec=code-oss --new-window %F Icon=com.visualstudio.code.oss

JaKooLit commented 1 month ago

can you try to see if its it clipboard manager?

after copy and wont paste

open clipboard manager

super alt V

then click and paste

Linxford commented 1 month ago

can you try to see if its it clipboard manager?

after copy and wont paste

open clipboard manager

super alt V

then click and paste

this works............. buh instead of ctrl c ctrl v directly...... that one isn't working, so all this while i have being using super alt v, then select the copied text and later paste directly.......... which works

JaKooLit commented 1 month ago

oh... well they are both electron based. So its al electron issue