bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 60 forks source link

Keep flickering with neovim. #104

Closed wakenmeng closed 3 years ago

wakenmeng commented 3 years ago

wl-clipboard: 1:2.0.0-2 system: Arch linux 5.9.9-arch1-1 neovim: 0.4.4 wayland: 1.18.0-2 xorg-server-xwayland: 1.20.9.r21.g5c400cae1-2

Issue:

When I type nvim . in gnome-shell to browse curren filetree, the gnome-shell starts to flicker, and I checked the gnome-session log, it shows a program keeps losing and regaining window focusing. Then I type nvim -V9 . to run vim in steps. And I found that in this step, the window got lost focus:

# Here not losing focus
Executing command: "'/usr/bin/wl-paste' '--no-newline' '--primary'"
Press ENTER or type command to continue

# Here losing focus
Executing command: "'/usr/bin/wl-paste' '--no-newline'"
Press ENTER or type command to continue

I have to Ctrl-tab to switch back to neovim and press Enter to continue.

I don't know which part cause this, nvim, gnome or xwayland, but the nvim didn't stuck at the first step above wl-paste with --primary, and losing focus with the second step, which without arg --primary. Is there any possible that the wayland may return something wrong while accessing non-primary clipboard?

YaLTeR commented 3 years ago

When I type nvim . in gnome-shell

Where do you type that? Also which terminal are you using and have you tried with nvim -u NORC? Might be some nvim plugin?

wakenmeng commented 3 years ago

When I type nvim . in gnome-shell

Where do you type that? Also which terminal are you using and have you tried with nvim -u NORC? Might be some nvim plugin?

I type it in gnome-terminal 3.38.1-2 (gnome). I tried nvim -u NORC, the shell still keep flickering. Also tried to remove the nvim config init.vim to prevent loading plugins, still didn't work. While I uninstall the wl-clippboard, nvim . in the terminal, things goes fine.

bugaevc commented 3 years ago

Hi!

The flickering you describe is an expected side effect of the rather ugly workaround that wl-clipboard has to use to steal focus on compositors that don't support the data-control protocol (such as Mutter). You can find a lot of other discussions concerning the flickering in many other issues in this repo.

However, it should flicker once when you copy or paste. It should definitely not flicker continuously. And ideally, it should only happen when you chose to copy or paste, not automatically on editor startup.

Now, sadly I cannot help you with your vim configuration. Can you reproduce the issue with wl-paste itself, without vim involved?

wakenmeng commented 3 years ago

Now, sadly I cannot help you with your vim configuration. Can you reproduce the issue with wl-paste itself, without vim involved?

Hi,

Thank u for the reply, I can't reproduce the issue with wl-paste itself. And you are right, It may be the neovim's problem. wl-clippboard works fine in vim. Sorry to bother u guys.

Thanks again.