GithubHelp home page GithubHelp logo

A way to disable clipboard? about avnc HOT 7 CLOSED

yousefamar avatar yousefamar commented on June 10, 2024
A way to disable clipboard?

from avnc.

Comments (7)

Rhys-T avatar Rhys-T commented on June 10, 2024 2

Potentially if there was a way to selectively disable sync from the primary buffer, and only use the clipboard buffer, that might solve it.

If it helps, that can be disabled from the server (TigerVNC) end. I did this on my Termux/VNC setup, because any time I typed anything into xfce4-appfinder, the autocomplete suggestion would be highlighted, and trigger a clipboard sync (and the "Copied to clipboard" toast).

Either pass -SendPrimary=0 into Xvnc when it starts, or run vncconfig -set SendPrimary=0 after the server is up and running. I've never used Andronix, but it sounds like it uses the usual vncserver script to start Xvnc, so you should be able to add a line saying SendPrimary=0 (without the dash) to the ~/.vnc/config file (inside the proot environment, I guess, if that's where TigerVNC is running).

There's also a SetPrimary option, which controls sending data from Android's clipboard to the PRIMARY selection, as well as SendCutText and AcceptCutText which sound like they can disable syncing for all selections/clipboards.

the "Copied to clipboard" toast is potentially a DeX-only thing.

It definitely happens outside of DeX too, at least on my device. Might still be Samsung/One UI-specific, though - all the references I'm finding are in the context of Samsung devices.

from avnc.

yousefamar avatar yousefamar commented on June 10, 2024 1

Thanks so much for this @Rhys-T! With your advice, I can now use clipboard sync again. I only have to contend with a small lag spike as I copy things with Ctrl+C, rather than constantly.

from avnc.

gujjwal00 avatar gujjwal00 commented on June 10, 2024

Glad to know you like AVNC, @yousefamar.

Yes, you can turn off clipboard sharing. Open AVNC Settings ⚙, and disable Clipboard sync in Servers.

If you don't mind, I would like to find the root cause though. Deliberately highlighting a random character reduces the size of text present on clipboard, so I am assuming it is caused by large text.

  • Can you reliably reproduce the issue by copying large text?
  • How big is the text?
  • Does it happen when you copy the text in Android itself, or on the server?
  • Is it fixed by disabling clipboard sync?

from avnc.

yousefamar avatar yousefamar commented on June 10, 2024

Thanks a lot @gujjwal00! I had completely overlooked that setting. Once I disabled clipboard sync, the problem went away entirely!

I have some potential clues to what (maybe) could be the cause:

  • I remember when I first started using AVNC, clipboard sync was only one-way. I think there was an open issue about it, or it was already closed but the update hadn't hit the stores yet. When clipboard sync was one-way, I didn't have this issue. I'm not sure exactly when I noticed that clipboard sync became two-way, but this issue definitely only happened then, although I can't say 100% if it's related.
  • I wasn't able to reliably reproduce or spot any patterns between large and small text. I also wasn't able to notice any patterns with with plain text vs text with weird formatting or emojis or similar.
  • This happens when I copy text on the server. The server is on the same phone (Termux, TigerVNC on proot Ubuntu, installed with Andronix). I haven't tested yet with a remote server. Originally, it would happen a lot in my chat clients. I thought "oh, they must be using loads of resources" and there was a slight correlation between closing programs and the issue improving. When I'm between 5-7GB RAM usage, it's less bad, then at 7+ it's much more frequent, total of 10.3GB RAM available. This correlation was weak though.
  • I mentioned that highlighting something triggers a clipboard sync to Android -- this is not the normal Ctrl+C copy, but rather that other register that you do scroll-wheel-click to paste highlighted text. I realised that in my chat client, even the act of backspacing a single character triggers a copy and clipboard sync. This happens in WhatsApp Web too if you're familiar with that.
  • I might be imagining things, but when I highlight some text anywhere (triggering sync) and immediately start typing to replace it, that's when the lag spikes hard. But if I highlight, wait a second until I see the Android "Copied to clipboard" toast, then type after that, it seems not to lag (?)

I was digging more into the difference between the scroll-wheel clipboard and the ctrl+v clipboard, and it seems that they're two different buffers in X11 called "primary" and "clipboard" (more info here and here). You probably know more about this than me, but potentially the issue is only limited to the "primary" buffer? . Potentially if there was a way to selectively disable sync from the primary buffer, and only use the clipboard buffer, that might solve it. This is hard to test, since usually copying to the clipboard buffer is preceded by highlighting text, which fills the primary buffer (so you actually get two syncs in a row, or depending on how you highlight, a barrage of syncs and you move your mouse to highlight more and more text).

I should mention btw that I'm using Samsung DeX on a Galaxy S22 Ultra. AVNC is running on a full-sized monitor, and the "Copied to clipboard" toast is potentially a DeX-only thing.

from avnc.

gujjwal00 avatar gujjwal00 commented on June 10, 2024

Thank you @Rhys-T for the workaround.

Sorry for not getting back to this sooner, @yousefamar. Does the small lag spike on Crtl+C happen with other VNC viewers too, or is it just AVNC?

Android apps can register to be notified whenever clipboard content changes (although newer versions restrict this to keyboard apps and the ones currently in foreground). So it is possible AVNC is triggering something else which is causing the lag. I have recently added a couple of tweaks to avoid unnecessary clipboard synchronizations done by AVNC.

from avnc.

yousefamar avatar yousefamar commented on June 10, 2024

No problem, thanks for looking into it! It was only AVNC, but the only other viewer I had used seriously was bVNC Pro.

I'm afraid I can no longer test the latest version as I got a new phone that doesn't have DeX, so I no longer use any VNC viewer, but I hope your tweaks resolve it for others!

from avnc.

gujjwal00 avatar gujjwal00 commented on June 10, 2024

Okay, I will close this issue then.

from avnc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.