Closed AntonSamokat closed 7 months ago
Please install x11-repo
and try again.
apt update && apt upgrade && apt install x11-repo && apt install xdotool
@licy183 Thanks, with
pkg install x11-repo
pkg install install xdotool
I have successfully installed xdotool
As I see this xdotool
tool is not supposed to be used for emulating keystrokes on Android OS outside Termux environment. I want to have bash script that is able to pause and resume media playback. On Ubuntu the following command is working:
xdotool key --clearmodifiers XF86AudioPlay
But in Termux with this command I get:
Error: DISPLAY environment variable is empty. Is there an Xorg or other X server running? You can try setting 'export DISPLAY=:0' and trying again.
Failed creating new xdo instance.
This is because xdotool
will be working only in X environment that Android device does not have:
Graphical Environment - Termux Wiki
Am I right that now it is not possible by Termux to simulate keystrokes in OS Android?
I have found corresponding Feature Request for Termux: Feature request: media playback control #413
probably you can use ADB to send keyevents. It needs to be manually connected every time device boots though.
adb shell input keyevent KEYCODE
KEYCODE can be found at https://developer.android.com/reference/android/view/KeyEvent
ADB can be installed through android-tools
@ewt45 Thanks, this is working approach. With rooted devices ADB can be configured even without need for manually connecting by USB to PC after each device boot.
I'll leave some references on that:
Nevertheless this possibility to send keystrokes by ADB does not cover Feature request: media playback control #413 since commands execution over TCP/IP is taking significantly more time than if this would be inside application by native API.
Writing this
native API
is not possible. There are a few reasons.
input keyevent
is implemented in Java.termux-app
or termux-api
for security reasons. That will be goddamn security breach because there are LOTS of users who simply copies scripts from Internet because "interistin wat it do".
Problem description
Corresponding Pull Request for xdotool package : https://github.com/termux/termux-packages/pull/12451
What steps will reproduce the bug?
After running
There is error - E: Package 'xdotool' has no installation candidate
What is the expected behavior?
Package installed
System information
termux-info: