Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard v0.82 (flathub on Ubuntu) steals focus every two seconds on Wayland #171

Open
2 of 6 tasks
DavidKoot opened this issue Oct 12, 2023 · 5 comments
Open
2 of 6 tasks
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@DavidKoot
Copy link

Describe the bug
Once I have used Clipboard it will keep stealing for a split-second every two seconds or so. Very annoying when using context menus or other, that will just disappear if anything else gets focus.

To Reproduce
I might have a bit specific setup. I'm on Ubuntu (Gnome) 22.04, and I use ddterm as my terminal app, which is a Gnome specific extension that displays a dropdown, screen-wide terminal. I noticed that using this with Clipboard, results in the Clipboard application opening in the background whenever I issue a cb command. I then would have to alt+tab to the Clipboard application which then disappears and with that completes the command. I therefore installed the Gnome extension 'NoAnnoyance' which focuses directly any new spawn application, so I don't have to alt+tab to the Clipboard application. Not sure if that all contributes to the bug, I'll try to turn that off the next time before I use cb. Once this Clipboard behaviour started, it doesn't help to turn off 'NoAnnoyance'.

Expected behavior
Clearly, I don't want something to interfere with my input through mouse and/or keyboard typing, every two seconds.

Screenshots
Can't make any screenshots

Version
Clipboard 0.82, from Flathub, on Ubuntu 22.04, possibly influenced by the extension 'NoAnnoyance' thatThe version of CB you're using, how you got it, and what system you're using. Didn't have this problem with 0.81, but I have it quite consistently on other computers as well where I use Ubuntu/gnome extenstions as well.

Questionnaire
Check these boxes to see if your issue is valid or not.

  • If I compiled CB, then any errors that may be present don't mention "LTO error" (this is sadly a bug with the compiler, not Clipboard)
  • If I compiled CB, then any errors that may be present don't mention "XYZ has not been defined in namespace std" (this sadly means you need a compiler with C++20 support, so upgrade first)
  • I check all these boxes without reading them
  • I think bachata is the best music
  • I'm using the latest commit/release (we only support the latest)
  • If I downloaded CB from GitHub Actions or with the install script, any errors that may be present don't mention "GLIBC XYZ not found" (your system is sadly too outdated for CB, so upgrade it)

Additional context
Add any other context about the problem here.

Before you post
Please make sure you check previous bug reports before filing a new one.
This will help keep the Issues section less cluttered. :)
Feel free to delete this section once you've completed this form.

@DavidKoot DavidKoot added the bug Something isn't working label Oct 12, 2023
@Slackadays
Copy link
Owner

This is because 0.8.2 added asynchronous clipboard syncing, where CB will refresh every 2 seconds in the background to grab any changed desktop clipboard contents. Unfortunately, because you're using Ubuntu 22.04 on GNOME, this means you have Wayland. And because Wayland has this horrible new security feature where a window needs focus to get the clipboard, CB and other clipboard managers have to add a horrible hack by opening a temporary 1x1 window just to get focus. There is a special feature that some desktop systems support that gets rid of this issue, but it would require special handling code in CB to use.

Therefore, you can try the following to work around this issue:

  • switch to X11
  • disable desktop clipboard syncing with export CLIPBOARD_NOGUI=1
  • wait for someone to add the special handling code to CB

@DavidKoot
Copy link
Author

That sounds pretty horrible indeed. Thanks for explaining, it also explains some of the other things I've seen. Need to think about what to do now. I have played around with CLIPBOARD_NOGUI, but I just like to use cb together with ctrl-v pasting. Don't like it much to go back to X11 either. I guess this closes the issue then.

@Slackadays
Copy link
Owner

Slackadays commented Oct 12, 2023

I can see if anyone would like to make a PR to add the special Wayland code before closing this, because this is a recurring issue on Wayland

@Slackadays Slackadays added the help wanted Extra attention is needed label Oct 12, 2023
@Slackadays Slackadays pinned this issue Oct 12, 2023
@Slackadays Slackadays changed the title Clipboard v0.82 (flathub on Ubuntu) steals focus every two seconds Clipboard v0.82 (flathub on Ubuntu) steals focus every two seconds on Wayland Oct 12, 2023
@Slackadays Slackadays unpinned this issue Oct 12, 2023
@Slackadays Slackadays pinned this issue Oct 12, 2023
@PlexSheep
Copy link

can cb maybe use wl-copy and wl-paste to sync the clipboards? I don't know how it's done in NeoVim, but I can copy from NeoVim to my system without opening a window. This is reduces the functionality of the app a lot for me.

@Slackadays
Copy link
Owner

can cb maybe use wl-copy and wl-paste to sync the clipboards?

Actually, this may be easily possible in a future version by adding a custom script hook to each clipboard. However, I haven't done anything to add this feature yet, so stay tuned.

@Slackadays Slackadays mentioned this issue Jan 2, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants