zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
42.08k stars 2.2k forks source link

Unable to Paste on Wayland #12054

Closed mastermach50 closed 1 month ago

mastermach50 commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I am able to copy and cut text from zed and even paste it in other windows, but I am unable to paste text in zed, neither using Ctr + V nor the editor: paste command

Environment

Zed: v1.0.0 (Zed) OS: Linux 1.0.0 Memory: 15 GiB Architecture: x86_64

Neofetch output just in case

OS: NixOS 24.05.20240519.6c0b7a9 (Uakari) x86_64
Host: ASUSTeK COMPUTER INC. M1603QA
Kernel: 6.6.31
Uptime: 17 mins
Packages: 2174 (nix-system)
Shell: nu 0.93.0
Resolution: 1920x1200
DE: Hyprland (Wayland)
Terminal: zed
CPU: AMD Ryzen 7 5800HS with Radeon Graphics (16) @ 4.463GHz
GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series
Memory: 2988MiB / 15394MiB

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

Titoot commented 1 month ago

Running Zed in x11 mode fixed it. WAYLAND_DISPLAY='' Zed

mastermach50 commented 1 month ago

@Titoot that method does work thanks.

But shouldn't this be fixed?

I am not closing this issue right now

croots commented 1 month ago

Also having this issue, cant copy paste on wayland.

Biggest adoption issue for me, pretty much expected for a text based editor.

apekros commented 1 month ago

Same issue, have to use WAYLAND_DISPLAY='' to resolve the issue on Arch/Hyprland

spikespaz commented 1 month ago

I politely posit that this issue ought to be marked as high-severity. Copy/paste does not work on Wayland desktops, where Xwayland may be unreliable or unavailable.

DissolveDZ commented 1 month ago

still hoping that this gets fixed soon, really annoying especially since xwayland is really glitchy on nvidia cards

skewballfox commented 1 month ago

So I just tried to reproduce on 2 different systems, one with gnome and an nvidia gpu, and the other using sway with an amdgpu, both were able to paste content into zed.

For the people who are having this issue:

Zollerboy1 commented 1 month ago

@skewballfox I had used zed under wayland (specifically hyprland) without any problems for quite some time now, but I just updated my zed version to 0.140.4-pre and suddenly this issue popped up. The behavior is quite strange, as copying and cutting text works just fine, only paste doesn't work at all (i.e. I can copy text in zed and paste it in another program, but I cannot paste text in zed regardless of whether it was copied in zed or somewhere else).

I'm launching zed using the cli, but I've also tried to launch the zed-editor binary directly, both through the desktop file and manually – the behavior is the same for all launch methods.

When launching zed directly from the terminal, I get a few error messages directly at launch but nothing afterwards (at least not when trying to paste something):

[2024-06-15T22:35:25+02:00 ERROR util] crates/gpui/src/platform/linux/platform.rs:109: Portal request failed: org.freedesktop.zbus.Error: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
[2024-06-15T22:35:25+02:00 ERROR util] crates/zed/src/main.rs:326: could not find git binary path

Caused by:
    Platform<LinuxPlatform>::path_for_auxiliary_executable is not implemented yet

This is (most of) my env output:

SHELL=/bin/zsh
GTK_THEME=Breeze-Dark
HYPRLAND_CMD=Hyprland
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session2
CLUTTER_BACKEND=wayland
XDG_BACKEND=wayland
DESKTOP_SESSION=hyprland
XCURSOR_SIZE=16
XDG_SEAT=seat0
XDG_SESSION_DESKTOP=Hyprland
QT_QPA_PLATFORMTHEME=gtk2
XDG_SESSION_TYPE=wayland
_=/usr/bin/env
MOTD_SHOWN=pam
LANG=en_US.UTF-8
XDG_CURRENT_DESKTOP=Hyprland
WAYLAND_DISPLAY=wayland-1
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
QT_QPA_PLATFORM=wayland;xcb
XDG_SESSION_CLASS=user
SDL_VIDEODRIVER=wayland
DISPLAY=:0
SHLVL=1
MOZ_ENABLE_WAYLAND=1
XDG_VTNR=2
XDG_SESSION_ID=2
XDG_RUNTIME_DIR=/run/user/1000
DEBUGINFOD_URLS=https://debuginfod.archlinux.org 
QT_AUTO_SCREEN_SCALE_FACTOR=1
XCURSOR_THEME=WhiteSur-cursors
GDK_BACKEND=wayland,x11
GDK_SCALE=2
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
QT_SCALE_FACTOR=2
KITTY_WINDOW_ID=2
TERM=xterm-kitty
COLORTERM=truecolor
TERMINFO=/usr/lib/kitty/terminfo
KITTY_INSTALLATION_DIR=/usr/lib/kitty
PAGER=less
LESS=-R

I'm running wl-clip-persist, if that has anything to do with the problem.

unkindypie commented 1 month ago

Same issue after update on arch/wayland

mastermach50 commented 1 month ago

@skewballfox My issues are the same as described by @Zollerboy1 (Hyprland, no errors in console when pasting)

The only difference is that I am on 0.136.2.

Similarly for me this paste issue was not present in an older version if I remember correctly (not sure which version).

Hence the issue is present in versions 0.136.2 to 0.140.4-pre

mastermach50 commented 1 month ago

Here is my env

Click to expand ``` COLORTERM=truecolor DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DESKTOP_SESSION=hyprland DIRS_POSITION=0 DISPLAY=:0 EDITOR=hx ELECTRON_OZONE_PLATFORM_HINT=wayland ELM_SCALE=1.8 GDK_BACKEND=wayland GDK_DPI_SCALE=1 GDK_SCALE=1.8 GIO_EXTRA_MODULES=/nix/store/g19314860ijffhbksw25pl2rcagk7wcx-dconf-0.40.0-lib/lib/gio/modules GTK_A11Y=none GTK_THEME=Colloid:dark MOZ_ENABLE_WAYLAND=1 NO_AT_BRIDGE=1 PAGER=less QML2_IMPORT_PATH=/home/mathew/.local/share/flatpak/exports/lib/qt-5.15.12/qml:/home/mathew/.local/share/flatpak/exports/lib/qt-6/qml:/var/lib/flatpak/exports/lib/qt-5.15.12/qml:/var/lib/flatpak/exports/lib/qt-6/qml:/home/mathew/.nix-profile/lib/qt-5.15.12/qml:/home/mathew/.nix-profile/lib/qt-6/qml:/nix/profile/lib/qt-5.15.12/qml:/nix/profile/lib/qt-6/qml:/home/mathew/.local/state/nix/profile/lib/qt-5.15.12/qml:/home/mathew/.local/state/nix/profile/lib/qt-6/qml:/etc/profiles/per-user/mathew/lib/qt-5.15.12/qml:/etc/profiles/per-user/mathew/lib/qt-6/qml:/nix/var/nix/profiles/default/lib/qt-5.15.12/qml:/nix/var/nix/profiles/default/lib/qt-6/qml:/run/current-system/sw/lib/qt-5.15.12/qml:/run/current-system/sw/lib/qt-6/qml QTWEBKIT_PLUGIN_PATH=/home/mathew/.local/share/flatpak/exports/lib/mozilla/plugins/:/var/lib/flatpak/exports/lib/mozilla/plugins/:/home/mathew/.nix-profile/lib/mozilla/plugins/:/nix/profile/lib/mozilla/plugins/:/home/mathew/.local/state/nix/profile/lib/mozilla/plugins/:/etc/profiles/per-user/mathew/lib/mozilla/plugins/:/nix/var/nix/profiles/default/lib/mozilla/plugins/:/run/current-system/sw/lib/mozilla/plugins/ QT_AUTO_SCREEN_SCALE_FACTOR=1 QT_FONT_DPI=85 QT_PLUGIN_PATH=/home/mathew/.local/share/flatpak/exports/lib/qt-5.15.12/plugins:/home/mathew/.local/share/flatpak/exports/lib/qt-6/plugins:/var/lib/flatpak/exports/lib/qt-5.15.12/plugins:/var/lib/flatpak/exports/lib/qt-6/plugins:/home/mathew/.nix-profile/lib/qt-5.15.12/plugins:/home/mathew/.nix-profile/lib/qt-6/plugins:/nix/profile/lib/qt-5.15.12/plugins:/nix/profile/lib/qt-6/plugins:/home/mathew/.local/state/nix/profile/lib/qt-5.15.12/plugins:/home/mathew/.local/state/nix/profile/lib/qt-6/plugins:/etc/profiles/per-user/mathew/lib/qt-5.15.12/plugins:/etc/profiles/per-user/mathew/lib/qt-6/plugins:/nix/var/nix/profiles/default/lib/qt-5.15.12/plugins:/nix/var/nix/profiles/default/lib/qt-6/plugins:/run/current-system/sw/lib/qt-5.15.12/plugins:/run/current-system/sw/lib/qt-6/plugins QT_QPA_PLATFORM=wayland QT_QPA_PLATFORMTHEME=kde QT_SCALE_FACTOR=1 QT_STYLE_OVERRIDE=breeze SDL_VIDEODRIVER=wayland SHELL=/run/current-system/sw/bin/nu SHLVL=0 TERM=xterm-kitty TERMINFO=/nix/store/cmkk0l1qs0hph06nlp0ji1arkpxp44xs-kitty-0.34.1/lib/kitty/terminfo TERMINFO_DIRS=/home/mathew/.local/share/flatpak/exports/share/terminfo:/var/lib/flatpak/exports/share/terminfo:/home/mathew/.nix-profile/share/terminfo:/nix/profile/share/terminfo:/home/mathew/.local/state/nix/profile/share/terminfo:/etc/profiles/per-user/mathew/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo WAYLAND_DISPLAY=wayland-1 XCURSOR_PATH=/home/mathew/.icons:/home/mathew/.local/share/icons:/home/mathew/.local/share/flatpak/exports/share/icons:/home/mathew/.local/share/flatpak/exports/share/pixmaps:/var/lib/flatpak/exports/share/icons:/var/lib/flatpak/exports/share/pixmaps:/home/mathew/.nix-profile/share/icons:/home/mathew/.nix-profile/share/pixmaps:/nix/profile/share/icons:/nix/profile/share/pixmaps:/home/mathew/.local/state/nix/profile/share/icons:/home/mathew/.local/state/nix/profile/share/pixmaps:/etc/profiles/per-user/mathew/share/icons:/etc/profiles/per-user/mathew/share/pixmaps:/nix/var/nix/profiles/default/share/icons:/nix/var/nix/profiles/default/share/pixmaps:/run/current-system/sw/share/icons:/run/current-system/sw/share/pixmaps XCURSOR_SIZE=20 XCURSOR_THEME=Bibata-Modern-Classic XDG_BACKEND=wayland XDG_CONFIG_DIRS=/etc/xdg:/home/mathew/.local/share/flatpak/exports/etc/xdg:/var/lib/flatpak/exports/etc/xdg:/home/mathew/.nix-profile/etc/xdg:/nix/profile/etc/xdg:/home/mathew/.local/state/nix/profile/etc/xdg:/etc/profiles/per-user/mathew/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg XDG_CURRENT_DESKTOP=Hyprland XDG_DATA_DIRS=/nix/store/yk6rngpjhyphjbxa4gyxm74889l6sdd5-desktops/share:/home/mathew/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/home/mathew/.nix-profile/share:/nix/profile/share:/home/mathew/.local/state/nix/profile/share:/etc/profiles/per-user/mathew/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share XDG_RUNTIME_DIR=/run/user/1000 XDG_SEAT=seat0 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP= XDG_SESSION_ID=2 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1 XDG_SESSION_TYPE=wayland XDG_VTNR=2 _JAVA_AWT_WM_NONREPARENTING=1 __ETC_PROFILE_DONE=1 __NIXOS_SET_ENVIRONMENT_DONE=1 ```
muqiuhan commented 1 month ago

I'm running Zed on Wayland using Nvidia don't have this issue:

image

Here is my env:

Click to expand ``` AUDIODRIVER=pulseaudio COLORFGBG=15;0 COLORTERM=truecolor CONFIG_SITE=/usr/share/site/x86_64-pc-linux-gnu CPU=x86_64 CSHEDIT=emacs DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DEBUGINFOD_URLS=https://debuginfod.opensuse.org/ DESKTOP_SESSION=plasmawayland DISPLAY=:1 FROM_HEADER= GLFW_IM_MODULE=ibus GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/muqiu/.gtkrc-2.0:/home/muqiu/.config/gtkrc-2.0 GTK_IM_MODULE=fcitx GTK_RC_FILES=/etc/gtk/gtkrc:/home/muqiu/.gtkrc:/home/muqiu/.config/gtkrc G_BROKEN_FILENAMES=1 G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252 HISTSIZE=50000 HOME=/home/muqiu HOST=localhost.localdomain HOSTNAME=localhost.localdomain HOSTTYPE=x86_64 ICEAUTHORITY=/run/user/1000/iceauth_uhdmgO INPUT_METHOD=fcitx INVOCATION_ID=b340b6d4bf1044a48955df0fb690d5a6 JOURNAL_STREAM=9:844659 JRE_HOME=/usr/lib64/jvm/java-21-openjdk-21 KDE_APPLICATIONS_AS_SCOPE=1 KDE_FULL_SESSION=true KDE_SESSION_UID=1000 KDE_SESSION_VERSION=6 KGLOBALACCELD_PLATFORM=org.kde.kwin KONSOLE_DBUS_SERVICE=:1.547 KONSOLE_DBUS_SESSION=/Sessions/1 KONSOLE_DBUS_WINDOW=/Windows/1 KONSOLE_VERSION=240500 LANG=en_US.UTF-8 LANGUAGE= LESS=-M -I -R LESSCLOSE=lessclose.sh %s %s LESSKEY=/usr/etc/lesskey.bin LESSOPEN=lessopen.sh %s LESS_ADVANCED_PREPROCESSOR=no LOGNAME=muqiu MACHTYPE=x86_64 MANAGERPID=24254 MANPATHISSET=yes MINICOM=-c on MORE=-sl MOZ_GMP_PATH=/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed NO_PROXY=localhost,127.0.0.1 OLDPWD=/home/muqiu OSTYPE=linux-gnu PAGER=less PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket PROFILEHOME= PROFILEREAD=true PWD=/home/muqiu PYTHONSTARTUP=/etc/pythonstart QEMU_AUDIO_DRV=pa QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_IM_MODULE=fcitx QT_IM_SWITCHER=imsw-multi QT_WAYLAND_RECONNECT=1 SDL_IM_MODULE=fcitx SESSION_MANAGER=local/localhost.localdomain:@/tmp/.ICE-unix/24423,unix/localhost.localdomain:/tmp/.ICE-unix/24423 SHELL=/usr/bin/zsh SHELL_SESSION_ID=cbfd2e8871e24edc97160568e89499d8 SOCKS5_SERVER= SOCKS_PROXY= SYSTEMD_EXEC_PID=24300 TERM=xterm-256color USER=muqiu VENDOR=suse WAYLAND_DISPLAY=wayland-0 WINDOWID=3 WINDOWMANAGER=/usr/bin/startplasma-x11 XAUTHLOCALHOSTNAME=localhost.localdomain XAUTHORITY=/run/user/1000/xauth_jNGneD XDG_ACTIVATION_TOKEN=kwin-22 XDG_CONFIG_DIRS=/home/muqiu/.config/kdedefaults:/etc/xdg:/usr/local/etc/xdg:/usr/etc/xdg XDG_CURRENT_DESKTOP=KDE XDG_DATA_DIRS=/home/muqiu/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share XDG_MENU_PREFIX=plasma- XDG_RUNTIME_DIR=/run/user/1000 XDG_SEAT=seat0 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP=KDE XDG_SESSION_ID=5 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session2 XDG_SESSION_TYPE=wayland XDG_VTNR=3 XKB_DEFAULT_LAYOUT=us XKB_DEFAULT_MODEL=pc105+inet XKB_DEFAULT_OPTIONS=terminate:ctrl_alt_bksp XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB XMODIFIERS=@im=fcitx XNLSPATH=/usr/share/X11/nls ```
bluthej commented 1 month ago

Also on Arch/Hyprland, doing what @apekros suggests does solve the pasting issue for me but then I can no longer scroll with the touchpad, while scrolling works if I launch zed without WAYLAND_DISPLAY=''

skewballfox commented 1 month ago

Some relevant context.

A couple more questions:

croots commented 1 month ago

I'm also on Hyprland so it seems like it indeed might be specific to that compositor. Haven't tested it but #12405 purports to fix the issue (or at least pasting in one direction?). Here's my env if it helps (redacting anything that looks like a key at a cursory glance)

PWD=/home/USR
MAMBA_ROOT_PREFIX=/home/USR/micromamba
SHLVL=2
GLFW_IM_MODULE=ibus
INPUT_METHOD=fcitx
XMODIFIERS=@im=fcitx
LOGNAME=USR
XDG_SESSION_TYPE=wayland
QT_IM_MODULE=fcitx
XDG_RUNTIME_DIR=/run/user/1000
SHELL=/usr/bin/zsh
QT_QPA_PLATFORMTHEME=qt5ct
CONDA_PREFIX=/home/USR/micromamba
XDG_BACKEND=wayland
MOTD_SHOWN=pam
CONDA_SHLVL=1
XDG_VTNR=1
MAMBA_EXE=/usr/bin/micromamba
HOME=/home/USR
MAMBA_SHLVL=0
STARSHIP_SESSION_KEY=[REDACTED]
CONDA_PROMPT_MODIFIER=(base) 
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
HYPRLAND_CMD=Hyprland
SYSTEMD_EXEC_PID=907
HYPRLAND_INSTANCE_SIGNATURE=[REDACTED]
LANG=C.UTF-8
CREDENTIALS_DIRECTORY=/run/credentials/getty@tty1.service
XDG_SEAT=seat0
TERM=xterm-256color
WAYLAND_DISPLAY=wayland-1
DEBUGINFOD_URLS=https://debuginfod.archlinux.org 
STARSHIP_SHELL=fish
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/system-getty.slice/getty@tty1.service/memory.pressure
QT_QPA_PLATFORM=wayland
XDG_CURRENT_DESKTOP=Hyprland
COLORTERM=truecolor
INVOCATION_ID=e139eb7036bc499799302eebfe37a5bf
_JAVA_AWT_WM_NONREPARENTING=1
OLDPWD=/home/croots
SDL_IM_MODULE=fcitx
MEMORY_PRESSURE_WRITE=[REDACTED]
USER=USR
PATH=/home/USR/micromamba/bin:/home/USR/micromamba/condabin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
MOZ_ENABLE_WAYLAND=1
XDG_SESSION_ID=1
XDG_SESSION_CLASS=user
MAIL=/var/spool/mail/USR
CONDA_DEFAULT_ENV=base
DISPLAY=:0
skewballfox commented 1 month ago

I'm also on Hyprland so it seems like it indeed might be specific to that compositor. Haven't tested it but https://github.com/zed-industries/zed/pull/12405 purports to fix the issue (or at least pasting in one direction?). Here's my env if it helps (redacting anything that looks like a key at a cursory glance)

I completely missed that one, my bad. I guess the best course of action is wait for that to be merged and test again. If it's not fixed then, I'll open a PR then (if someone doesn't beat me to the punch)

unkindypie commented 3 weeks ago

Still not fixed on 0.140.5 for arch/hyprland. Tried also to run the version from latest commit (zed-git arch package), it didn't launch at all @mikayla-maki

GioPan04 commented 3 weeks ago

@unkindypie The refactor of the clipboard implementation is not mentioned in any release changelog, so it's probably not been released yet

croots commented 3 weeks ago

@unkindypie AUR zed-get is not configured to build from the latest commit, its configured to build from the latest release. Cloning the repo and building from source has fixed this issue for me.

Zollerboy1 commented 3 weeks ago

@unkindypie It's fixed in 0.141.1-pre for me. You could also use the zed-preview-bin AUR package if you want to get the latest preview versions.

unkindypie commented 3 weeks ago

Got you, thank you I didn't know that git package doesn't use latest commit version

lufog commented 3 weeks ago

@unkindypie It's fixed in 0.141.1-pre for me. You could also use the zed-preview-bin AUR package if you want to get the latest preview versions.

Strange, paste from the clipboard on Wayland still doesn't work for me in 0.141.3 (from Arch repo).

mastermach50 commented 2 weeks ago

Same here. Issue resolved on 141.2