termux / termux-api Goto Github PK
View Code? Open in Web Editor NEWTermux add-on app which exposes device functionality as API to command line programs.
Home Page: https://f-droid.org/en/packages/com.termux.api/
Termux add-on app which exposes device functionality as API to command line programs.
Home Page: https://f-droid.org/en/packages/com.termux.api/
Noticed that many pictures are with completely wrong focus and exposure.
Is it possible that the first termux-camera-photo call sets focus & exposure and subsequent calls don't refocus?
It might be an idea to create
termux-camera-focusmode mode [time]
mode: continous, infinity
which would set the camera to the given mode for the given timespan.
All commands hang and never return on android6.0
I get an installation error about shared resources when installing. I suspect the app needs to be signed by the same key as termux itself?
Hi. I've noticed this today:
$ echo "Hello World" | termux-clipboard-set
$ termux-clipboard-get
Hello
$ termux-clipboard-set "Foo Bar"
$ termux-clipboard-get
Foo
Using termux as a Tasker like apps plugin
termux-camera-photo pruduces black picture output (jpeg file size ~250-300 kb).
The issue only happens with termux-api v0.11 and v0.10.
Version 0.9 works fine and produces good photo.
Already mentioned in g+:
$ termux-location
yields empty output
$ termux-location -r last
{
"API_ERROR": "Failed to get location"
}
Have same behaviour on two different devices both running CM12
// don't have environment for debugging yet
Hi, last year we talked about rudimentary tools to write to the external sd card using the API here: https://plus.google.com/u/0/112187690141583660341/posts/a7vMDeZUENs
I am just opening this here to track it and so it doesn't get forgotten.
Something like termux-cp
, termux-mv
and termux-rm
could be implemented into the API and the Java app can then do the proper calls to Android API and copy, move or delete the files.
Is it possible to map a keyboard shortcut to bring up the list of urls available to open? Alternatively, can we make termux work with this https://github.com/tmux-plugins/tmux-open ?
I like to make/have termux-api available via REST, for example:
Android:
% termux-rest &
PC:
% curl 'http://192.168.2.100:8091/camera-photo?c=1'
retrieves JPEG direct
% curl http://192.168.2.100:8091/camera-info
retrieves JSON
etc. essentially http://x.x.x.x:port/(\w+)?(.+)
-> termux-$1 $2
(with some proper argument parsing)
Question: what would be the easiest way (programming framework) to implement this lightweight http server providing the functionality?
I quickly coded (2hr) perl script which implements basic web-server which calls termux-* (with simple argument parsing) and takes output to return to http GET request, yet, it might be more suitable to use termux-api.c direct and put a small web-server into it, which connects to the internal API instead via termux-* -> termux-api -> am -> tcp.
I like to probe multiple android phones for battery info (actually the battery temperature is what I care about) and take photos via REST, turning Android smartphones into IoT devices.
My quick hack does this, accessing http://192.168.2.100:8091/ gives an overview of the services:
termux-rest (0.0.2) services:
battery-status
camera-info
camera-photo: c=<...>
location
telephony-cellinfo
telephony-deviceinfo
tts-engines
tts-speak: speak=<...>
vibrate
with Content-Type: text/html
, each service listed is a link.
and http://192.168.2.100:8091/battery-status:
{
"health": "GOOD",
"percentage": 97,
"plugged": "UNPLUGGED",
"status": "DISCHARGING",
"temperature": 23.600000381469727
}
with Content-Type: application/json
and CORS set so XHR JavaScript requests can be made.
Backwards facing camera, id 0, produces empty file:
$ termux-camera-photo -c 0 camera0.jpg
$ ls -l
total 0
-rw------- 1 u0_a260 u0_a260 0 Mar 21 15:32 camera0.jpg
Frontfacing camera, id 1, works just fine:
$ termux-camera-photo -c 1 camera1.jpg
$ ls -l
total 244
-rw------- 1 u0_a260 u0_a260 0 Mar 21 15:32 camera0.jpg
-rw------- 1 u0_a260 u0_a260 247734 Mar 21 15:33 camera1.jpg
Device: Samsung Galaxy S4 Active
Model number: GT-I9295
Android version: 5.0.1
$ termux-camera-info
[
{
"id": "0",
"facing": "back",
"jpeg_output_sizes": [
{
"width": 3264,
"height": 2448
},
{
"width": 3264,
"height": 1836
},
{
"width": 2048,
"height": 1536
},
{
"width": 2048,
"height": 1152
},
{
"width": 1920,
"height": 1080
},
{
"width": 1280,
"height": 720
},
{
"width": 640,
"height": 480
}
],
"focal_lengths": [
3.700000047683716
],
"auto_exposure_modes": [
"CONTROL_AE_MODE_ON",
"CONTROL_AE_MODE_ON_AUTO_FLASH",
"CONTROL_AE_MODE_ON_ALWAYS_FLASH"
],
"physical_size": {
"width": 3.8357956409454346,
"height": 2.8777027130126953
},
"capabilities": [
"backward_compatible"
]
},
{
"id": "1",
"facing": "front",
"jpeg_output_sizes": [
{
"width": 1920,
"height": 1080
},
{
"width": 1440,
"height": 1080
},
{
"width": 1392,
"height": 1392
},
{
"width": 1280,
"height": 720
},
{
"width": 960,
"height": 720
},
{
"width": 640,
"height": 480
}
],
"focal_lengths": [
1.850000023841858
],
"auto_exposure_modes": [
"CONTROL_AE_MODE_ON"
],
"physical_size": {
"width": 0.03228941187262535,
"height": 0.03228941187262535
},
"capabilities": [
"backward_compatible"
]
}
]
Like termux-dialog
but with a selection-box.
noticed that it won't set any mime type, this works for urls starting as "http://" but fails with "file://" . Setting mime to text/html makes that work.
Perhaps an option to specify the mime type explicitly would good?
If we can start tts server beforehand, the delay could be minimized.
I am using s5 version 5.0 , i am using rooted cell .when i try to execute make . Its saying permission denied.
make: execvp: /system/bin/sh: Permission denied
I would like to have a command to control the notification led. I would want to be able to toggle it, set it to blink and choose color.
There is an interface in /sys/class/leds but it requires root.
Hello
I installed the termux application, installed the API from the app store, updated the app on the phone, installed the termux api inside the termux app. I cannot get any of the functions to run except for the -help function. When I try running the application I have the application that just sits there and does nothing.
Android version: 5.0
Phone: asus zenfone 2
What should I try doing to get the functions to work.
When I pipe text into termux-clipboard-set
or run termux-clipboard-get
, the command just hangs. To get my prompt back, I have to use ctrl-c.
I thought of termux-share
as kde-open
or gnome-open
or cygstart
. However, its behavior is different. When I open a text file using termux-share
(as in example below), my editor (QuickEdit Pro) receives a file with url
content://com.termux.sharedfiles//storage/emulated/0/x.txt, which the editor app cannot save.
However, when I locate the file in a file manager and then open it, the url is correct
/storage/emulated/0/x.txt, and the editor app can save my changes.
How can termux-share
open files in other apps just like my file manager does.
$ ls
x.txt
$termux-share x.txt
Currently the api calls fails silently if a runtime permission is not granted. We need to change this to check for and if necessary request the permission at runtime.
I have installed the App and the package, but when I run any command of the API it just blocks until I cancel it with CTRL-C.
Displaying the help (-h) works though.
I've tried to install Termux:Api on a rooted Nexus 6P running Nougat (7.1.1 Build NMF26F
).
I've tried rebooting and clearing google play cache. To no avail.
Google Play issues the following errorcode -505
, which to my understanding is a catch-all for various errors.
The device has sufficient storage memory.
The same happens when trying to install Termux:Task on that device.
happened to share a script by email (k9mail) and the attachment was mangled to contain "\r" at line ends.
termux-fix-shebang fixed the path but not the "\r", resulting in a rather "mysterious" error message.
dos2unix fixed it.
Btw.. isn't there some way to workaround to avoid needing to fix shebang paths at least for the primary shell?
Tried the obvious, "\n" but doesn't work?
Hey folks,
Thought you'd find this interesting; I rewrote in Go the C tool and scripts from the termux-api
tools normally installed through apt to use this App. In theory, this means you can compile Go apps that make calls to termux-api
to use the APIs from Go.
Lots of it is completely untested, including things like "sending Stdin down a Unix pipe". Only some tools have been tested at all.
Also, the struct values for SMS messages from SmsInbox and from TTS engines are currently unknown because I get no results for these on my phone (SMSsecure protects sms, and no TTS engines).
Thanks for a great app, I'm looking forward to playing with pure-Go pseudo-apps thanks to Termux. :)
This would be great for not having to take you phone out when connecting via SSH.
Here is feature request for more widgets / controls / dialogs for termux-dialog
. Like dialog
unix ncourses equivalent offer multiple more options including: radio lists, multiple choice lists, "menu", progressbar, timebox, calendar (with --date-format option), etc...
I would appreciate arguments compatibility so script could easily switch between dialog
and termux-dialog
depending on tool availability.
I am glad I can still use standard dialog
unix tool and interact via touch on Android device, but how nice would it be to interact with potential user via native Android UI?
Thankd a lot for whole work - so far enjoying dialog
on Android :)
is there any way to execute commands when tapping a selection?
would it be possible?
The stream, AudioManager.STREAM_SYSTEM is not adjustable on my Android 5.0 Asus Fonepad through the volume control app. I tried adjusting the STREAM_SYSTEM volume manually through a Rhino JS tool (Scriptit), but although I can adjust the STREAM_MUSIC that way, STREAM_SYSTEM stays at full volume.
Other tts systems seem to use either STREAM_DEFAULT or STREAM_MUSIC. Are there constraints which cause termux to use STREAM_SYSTEM?
Any possibility of adding a command line argument to take a string an send it to the recipient? Without this, the interface is unusable from any other program.
Not sure where else to post this. I don't have a G+ account (and never will).
The sequence ctrl+shift++ is not working on my k810 bluetooth keyboard (tenkey less). I think since the + requires shift to register and shift is already being used for the sequence the text size increment is not registering.
Hello! I would like to implement the following:
When SMS arrives, my computer shows me a notification with it's text and sender.
That's how I see the implementation: using termux, somehow listen to incoming sms, and if sms comes, parse termux-sms-inbox output and pipe it to netcat, on desktop listen to netcat and handle incoming info. Could you please give me a piece of advice on how to listen to incoming sms? Of course, I can run termux-sms-inbox regularly and compare output, but it doesn't seem to be an effective way of doing it. Thanks in advance.
After update && upgrade, I found this behaviour:
termux-dialog -t "Foo Bar"
->empty mask
termux-notification -c "hello world" -t "foo bar"
->
->hello world
Hi,
"termux-clipboard-set" doesn't exit on my device. It seems to be stuck in a loop. It used to work before.
I've recorded it here: https://asciinema.org/a/esqy5c1yyxk6vv2nf7xl48ugk
When I install by executing "apt install termux-ap" it say "Unable to locate package termux-api".
I install termux-api from Google Play.
From @destiny07 on March 27, 2016 8:31
termux-camera-photo -c 0 pic1.jpg
produces a file of size 0B. When opened with gallery, it say's thumbnail cannot be retrieved.
Copied from original issue: termux/termux-packages#185
Is there any plan to add a screenshot API, which I think will be really useful. I know there's an screencap command but that requires root privilege.
Cheers!
Apple tts has a nice sugarcandy which would be incredibly useful in shell scripts - the possibility to embed commands into the text such as [[emph +]], [[slnc 6000]], [[volm +0.4]]. Could also use [[beep duration pitch]] or [[play file.ogg]] which apple does not seem to have.
I found the Android Pico TTS supports it (Chapter 7 of its documentation) and a few related stackoverflow posts:
http://stackoverflow.com/questions/3495301/best-practice-for-specifying-pronunciation-for-android-tts-engine
http://stackoverflow.com/questions/3495301/best-practice-for-specifying-pronunciation-for-android-tts-engine
Not sure if it can work without speacial help of termux-api?
From @koppi on April 6, 2016 18:11
Is it possible to access the gyroscope data of the device via shell script?
Copied from original issue: termux/termux-packages#204
I would like to see an option on termux-clipboard-set
or a new command that allows you to remove items from the clipboard. For example, when copying a password from pass, I want the password to be deleted from the clipboard after a certain amount of time.
I tried to find a existing global Android intend for this purpose but didn't discovered one. termux-play
is already listed in the idea section and would be very appreciated.
I suspect it's GPLv3, but it would be nice to have that stated in the readme or a special license file.
Calling termux-camera-info in my kindle 8" fireos raises the following error message:
CANNOT LINK EXECUTABLE DEPENDENCIES: "libandroid_runtime.so" is 64-bit instead of 32-bit.
Suggestions?
Hi.
The latest update of the main app broke the api. For example termux-battery-status
yields:
"/system/bin/am[8]: app_process: not found"
After adding /system/bin
back to the $PATH will make it work again.
The issue being that I'm trying to update and will not go all the way through due to an error "http://termux.net stable/main i686 Packages Writing more data than expected (186946 > 186906)". I have tried to uninstall and reinstall, but no luck. Any help would helpful :).
Hi,
I am using an lg g3 and not any custom rom and i did not rooted my device.
I installed termux-api app and updated and upgraded my apt too.
However when i want to call any termux api command in the termux terminal, i see this error message:
/data/data/com.termux/files/usr/bin/am: 3: exec: /system/bin/am: Permission denied
Hi
A command that would allow us to hide and show the software keyboard.
termux-keyboard-show
/ termux-keyboard-hide
This would allow for scripts that automatically go into 'fullscreen' at the start and show the keyboard again when it is done.
Additionally something like termux-keyboard-visible
would also be very usefull, to check whether the keyboard is present to begin with.
Example:
isKeyboardVisible=$(termux-keyboard-visible)
termux-keyboard-hide
./presentation.sh
if [ $isKeyboardVisible ]; then
termux-keyboard-show
endif
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.