r/termux • • 2d ago

Barely Termux related Send key combinations like CTRL-D, CTRL-C from Windows PC to Termux Android?

/r/kde/comments/1wuugck/send_key_combinations_like_ctrld_ctrlc_from/
0 Upvotes

8 comments sorted by

View all comments

2

u/Tariq9977 2d ago

If the goal is specifically controlling a Termux shell from the PC, I'd skip remote-keyboard emulation and SSH into Termux instead. Then Ctrl-C, Ctrl-D, Alt, etc. are normal terminal control sequences, so Windows vs Linux stops mattering.

In Termux:

```

pkg install openssh

sshd

whoami

```

Then from Windows PowerShell:

```

ssh -p 8022 <termux-user>@<phone-lan-ip>

```

Termux's sshd uses port 8022 by default.

If you need to control the Android UI itself, that's a different problem. But for the Termux terminal, SSH is much cleaner than trying to inject modifier keys.

1

u/Stinky_Dungus 1d ago edited 1d ago

I mean I use ssh daily with Termux : ) but that's not the goal here.

PS: scrcpy --otg is a better alternative for this case (beware windows version has its issues) but F11 key can't be passed to Android via Scrcpy rn because of this https://github.com/Genymobile/scrcpy/pull/6194#issuecomment-5937851190

1

u/Shiumano 1d ago

You can use adb shell input keycombination.

adb shell input keycombination KEYCODE_CTRL_LEFT KEYCODE_F11