termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
1.96k stars 301 forks source link

Copy past from Android to termux-x11 #347

Closed Revess closed 6 months ago

Revess commented 1 year ago

Currently it is not possible to paste anything from the clipboard of android to any application running in termux-x11 (tested in proot).

twaik commented 1 year ago

Android blocks background clipboard access so it is not possible to get clipboard change notification when app is not focused. But it is possible to paste text using text input. To access it you should swipe extra keys bar to the left.

risharem commented 1 year ago

I've been able to do copy/paste from/to Android using VNC. Sometimes it needs autocutsel. Is AVNC any different than termux-x11 in the way they listen for Android clipboard?

twaik commented 1 year ago

Maybe it is relevant for old Androids, but starting from Android 10 listening to Android Clipboard is restricted

Blocked commented 9 months ago

@twaik Do we even need background clipboard access? When the X11 is brought to foreground and when a special key combination like CTRLSHIFTALTV is pressed, Is it possible to enable force clipboard syncing from android to termux x11?

EDIT: Apparently, there's a PASTE key, which isn't documented in the wiki

https://github.com/termux/termux-x11/blob/1a3bbd442ceb3bb6a8918c1070ff016f4fb6bcf4/app/src/main/java/com/termux/x11/utils/TermuxX11ExtraKeys.java#L163

This is much better, but still sync on "brought to foreground"( Special key combinations, especially for external keyboards) would be even better.

Blocked commented 9 months ago

@twaik Ok for some reason, PASTE doesn't work when clicking with a mouse, but it works when touching with finger(the same is true for all input in extra keys).

Even swiping extra keys to left, entering data and pressing enter doesn't send input data to x11. I'm testing this on firefox/x11 URL input, search input and text input in GitHub issues.

Currently I'm using a complex workaround in termux app using

echo "Clipboard Data to x11" | xclip -sel clipboard

Just xclip to PRIMARY clipboard doesn't work. You have to use xclip -sel clipboard

Consider reopening this issue. Even android chrome will detect clipboard urls when open, in the latest androids

customautosys commented 6 months ago

Hi I don't understand, how do I use this "paste" key? It doesn't seem to appear on any soft keyboards

JeremyViehland commented 6 months ago
![Screenshot_20240306-050129_Termux](https://github.com/termux/termux-x11/assets/13064800/48b3c646-2014-445f-a88f-4de91fdf0ed7)
![Screenshot_20240306-050605_Termux_X11](https://github.com/termux/termux-x11/assets/13064800/362d6de9-0805-4719-a797-36c8f2881615)
![Screenshot_20240306-051913_Termux](https://github.com/termux/termux-x11/assets/13064800/ca701b91-6ff5-44b1-8186-a853b3010f10)
twaik commented 6 months ago

@JeremyViehland sorry, deleted your message by mistake

JeremyViehland commented 6 months ago

@twaik No problem, was still editing. Hopefully the screen shots help elucidate the workaround.

twaik commented 6 months ago

@JeremyViehland Please, use <details> tag for screenshots.

twaik commented 6 months ago

It seems like I found acceptable design for this. I even can make system toast "Termux:X11 accessed clipboard" appear only when user uses "Paste" or "Ctrl+V" in desktop session. It will take some time.

twaik commented 6 months ago

Check the https://github.com/termux/termux-x11/actions/runs/8281260198 artifact.