termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
35.56k stars 3.73k forks source link

copy and paste using Ctrl-C Ctrl-V or right click menu #1891

Open zhangfuwen opened 3 years ago

zhangfuwen commented 3 years ago

Feature description

I am using this app(it is awesome) in desktop mode. I have a keyboard and mouse. I noticed that I can't paste to or copy texts from this app which is not convenient.

Reference implementation

I was not able to find a reference implementation.

ghost commented 3 years ago

I can't paste

CTRL + ALT + V for paste from hardware keyboard.

Copying is not supported at the moment as Termux was designed for touch screen devices primarily.

freebrowser1 commented 3 years ago

Weird. When I log into Termux with SSH from a Mac using the standard macOS Terminal app, copying just works like copying on the local terminal (Cmd+C) after selecting text. The same applies to a Linux terminal (Ctrl+Shift+C), regardless whether Centos or Ubuntu / Debian.

Windows is a different story, as copying and pasting into a Windows 'terminal' ('command prompt') uses some weird gestures and shortcuts.

From the Android device itself, one can hold a finger inside the Termunx terminal and Termux allows copying as well.

coltexx commented 3 years ago

👀

zhangfuwen commented 3 years ago

Weird. When I log into Termux with SSH from a Mac using the standard macOS Terminal app, copying just works like copying on the local terminal (Cmd+C) after selecting text. The same applies to a Linux terminal (Ctrl+Shift+C), regardless whether Centos or Ubuntu / Debian.

Windows is a different story, as copying and pasting into a Windows 'terminal' ('command prompt') uses some weird gestures and shortcuts.

From the Android device itself, one can hold a finger inside the Termunx terminal and Termux allows copying as well.

I am using android device itself as a computer. So I am trying to copy and paste using termux app itself.

sevmonster commented 3 years ago

@freebrowser1

Weird.

This is a discussion about the Termux terminal emulator—a part of and not the whole of Termux. Meanwhile you are connecting to Termux SSH daemon using other terminal emulators (Mac, Linux, Windows), which have different features. It's not weird at all that completely seperate terminal emulators would have completely independent feature sets...

@zhangfuwen Ctrl+[CV] are Windows conventions, in traditional Linux terminals Shift-Insert is used for pasting and selecting automatically copies to the buffer... So we should also be asking if Shift-Insert could be supported in this manner. I reflexively try to use it on Android still with the OSK to no effect. (This could also be due to strange keycodes being passed from Hacker's Keyboard if it otherwise should be working.)

suhan-paradkar commented 3 years ago

@agnostic-apollo @xeffyr I guess it will be more practical and easier to implement a PASTE extra-key to paste the clipboard content....

agnostic-apollo commented 3 years ago

@suhan-paradkar That can technically be implemented but what for use case do you want to use it for?

With hardware keyboard, ctrl + alt + v should work.

With touch screen, context menu is used for pasting, but requires long hold first, do you want this to be easier?

suhan-paradkar commented 3 years ago

With hardware keyboard, ctrl + alt + v should work.

Yes.. But Extra keys hardly is required by those using hard keyboard

With touch screen, context menu is used for pasting, but requires long hold first, do you want this to be easier?

Yes.. obviously.. It becomes hectic to first long press and then press upon the context menu when using multiple copy paste operations....

Also.. it is difficult to use keyboard's own clipboard popup view...

It's easier.. both for implementation and usage.. a paste button to paste the clipboard content directly...

agnostic-apollo commented 3 years ago

Okay, will look into adding the extra key.

Also.. it is difficult to implement keyboard's own clipboard popup view...

Do you mean termux's own clipboard with history like Gboard has?

suhan-paradkar commented 3 years ago

Do you mean termux's own clipboard with history like Gboard has?

No.. I meant this overlay.... Screenshot_2021-07-18-17-36-35-23

agnostic-apollo commented 3 years ago

That's only shown with https://wiki.termux.com/wiki/Touch_Keyboard#Text_Input_View

Keyboard suggestions, autocorrect, autocomplete etc do not work in normal mode since terminal view is not a text field.

https://github.com/termux/termux-app/blob/v0.117/terminal-view/src/main/java/com/termux/view/TerminalView.java#L265

suhan-paradkar commented 3 years ago

Yes ... That's why adding a PASTE button as an extra key helps a lot...

agnostic-apollo commented 3 years ago

Okay.

agnostic-apollo commented 3 years ago

@suhan-paradkar Check 7d76e8b1

Moreover, Ctrl+C can't be used for copying since its supposed to send SIGINT and Ctrl + Alt + C can't be used since "someone" decided to use it for creating new termux sessions. https://wiki.termux.com/wiki/Hardware_Keyboard

suhan-paradkar commented 3 years ago

Great 👍👍 I will now add that to T: Wayland WIP Branch also....

RalfWerner commented 3 years ago

Check 7d76e8b

@agnostic-apollo Unfortunately, I had no success in the shot with your update of termux.apk and nano .termux/*.Properties: grafik I've expected with Copy in the pop menu to get the selected text in the clipboard and the symbol and not the word PASTE and clipboard text and not the word (above the red line). Behind it is Paste from the pop menu - correct. PASTE in Extra Keys ist the first and in popup over TAB. Both dont do it - what is wrong and what you've got?_

I will now add that to T: Wayland WIP Branch also....

@suhan-paradkar The idea is good but would it be not easier for T: X11 to use the same sources?_ That would probably also simplify my request to the Extra Key merge of the two apps.

agnostic-apollo commented 3 years ago

The PASTE extra key only pastes the current text in clipboard at current cursor position just like the Paste option from Copy/Paste/More menu. Working on android 7 device and android 10 avd.

RalfWerner commented 3 years ago

The PASTE extra key only pastes the current text in clipboard at current cursor position

That is what I've exspected but not get (first 5 char above red line)! In *properties (Shot above) you find, what I've used. The Example is Android 11 and just now I've repeat it thth Androit 8 with the same result. What get you. when you doing the same?

The PASTE button exist also before your update and did not have a symbol there, but I never used it. I've made another check with extra-keys=[[{macro:PASTE,display:INS}... get again the word PASTE and in the EK line is INS.

The changes to my current 117.apk (22 hours ago) have been made in 14 sources since my last merge and are still 230.

agnostic-apollo commented 3 years ago

@suhan-paradkar is it working for you?

suhan-paradkar commented 3 years ago

I haven't checked it out yet...

agnostic-apollo commented 3 years ago

Cool, let me know if there is a problem.

suhan-paradkar commented 3 years ago

@agnostic-apollo I checked it in my device and it works perfectly....

The idea is good but would it be not easier for T: X11 to use the same sources?_ That would probably also simplify my commit to the Extra Key merge of the two apps.

@RalfWerner Well.. I actually use the same source.. but T:X11 implements its keyboard functioning in a slightly different way.. the reporting of keyboard events is mediated by libxkbcommon native library.... So.. same source... Slight changes

agnostic-apollo commented 3 years ago

Thanks. In future I may move extra keys to termux-shared if possible, but some termux-app specific logic exists inside it currently so will have to see if its possible easily. Probably require some interface too.

suhan-paradkar commented 3 years ago

@agnostic-apollo I guess it would be better if Extra-keys were moved into a seperate library instead of termux-shared... That way.. those devs who need extra-keys in their apps will need to just import a so-called "termux-extra-keys" library.. instead of whole of termux-shared... Which.. only some of them would want to be in their apps

but some termux-app specific logic exists inside it currently so will have to see if its possible easily. Probably require some interface too.

Yes.. I have seen them... And had replaced them with T:X11 ones in one my fork's branches...

agnostic-apollo commented 3 years ago

moved into a seperate library instead of termux-shared..

That would be more appropriate, lot of termux-shared stuff can be used by other apps and may be more appropriate in separate libraries. The issues is that then each library needs to be published separately, with Jitpack it should be relatively easy, although I'm not as complacent about it from a security point of view. Also versioning has to be done for each so will have to wait for a full release each time of libraries even if new stuff has been merged, unless instead of setting a library version in dependency, the commit hash is used. https://jitpack.io/docs/

And had replaced them with T:X11 ones in one my fork's branches...

Yeah, saw that a while back. But if the library provides a base implementation, the importer can inherit the class and override relevant functions only to handle specific logic and then call the super method if needed to handle the common ones. It's doable but other changes need to be made to extra keys like locking the special extra keys on quick double tap or Shift support, so further design changes may be needed. I likely won't have time to do it in the near future though, other priorities.

suhan-paradkar commented 3 years ago

Great👍

RalfWerner commented 3 years ago

@suhan-paradkar I checked it in my device and it works perfectly...

I suspect you cloned the current Termux app. Are your extra-keys in *Properties comparable with my shot or dit you check T:X11?

Well.. I actually use the same source.. but T:X11 implements its keyboard ...

I check a T:X11 clone from you (9 days old) where are the newest one (works perfectly)?

suhan-paradkar commented 3 years ago

I check a T:X11 clone from you (9 days old) where are the newest one (works perfectly)?

I said that the Termux-app works perfectly.. not my fork.... I am yet to add Extra-keys to my fork...

RalfWerner commented 3 years ago

I said that the Termux-app works perfectly.. not my fork...

Nice for you and *Properties comparable (! assume we use the same Termux-app)?

0dminnimda commented 1 year ago

Are there any updates to this?

RalfWerner commented 1 year ago

If you use the last artifact of @twaik, the Extra-keys managed in an other storage than Termux see here but works in the same way as before.

lattice0 commented 1 year ago

control alt v does not work for me on Android Samsung Dex with hardware keyboard

bkdwt commented 1 year ago

control alt v does not work for me on Android Samsung Dex with hardware keyboard

Same problem here when I try to past on my EC2 instance using Termux on Dex.

lattice0 commented 1 year ago

@bkdwt termux should focus on Android for tablets as it's the next gen operating system. Something as simple as control v should work

pzi123 commented 6 months ago

I manage to operate with the bluetooth mouse and keyboard connected to my samsung tablet running termux. Left mouse button press/hold - just like the finger press - brings the cut/paste function where I can move the start/stop arrows and copy the text. To paste you can use ctrl-alt-v or again press/hold the left mouse button and the paste function is activated.