https://github.com/eternal-flame-ad/go-termux
termux api wrappers for golang
https://github.com/eternal-flame-ad/go-termux
android android-api golang termux termux-api
Last synced: 3 months ago
JSON representation
termux api wrappers for golang
- Host: GitHub
- URL: https://github.com/eternal-flame-ad/go-termux
- Owner: eternal-flame-AD
- License: apache-2.0
- Created: 2018-11-15T04:42:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-20T20:22:54.000Z (about 4 years ago)
- Last Synced: 2025-08-29T23:49:53.612Z (9 months ago)
- Topics: android, android-api, golang, termux, termux-api
- Language: Go
- Size: 34.2 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-termux
[](https://godoc.org/github.com/eternal-flame-AD/go-termux)
Golang wrapper for termux:API. This package calls termux:API methods directly so that this package would work without termux-api package installed.
## Examples
### Acquires the current battery percentage
```golang
package main
import (
"fmt"
tm "github.com/eternal-flame-AD/go-termux"
)
func main() {
if stat, err := tm.BatteryStatus(); err != nil {
panic(err)
} else {
fmt.Printf("The current battery percentage is %d%%.\n", stat.Percentage)
}
}
```
### Sets current clipboard content
```golang
package main
import tm "github.com/eternal-flame-AD/go-termux"
func main() {
if err := tm.ClipboardSet("ummmm"); err != nil {
panic(err)
}
}
```
### Displays a short toast
```golang
package main
import (
tm "github.com/eternal-flame-AD/go-termux"
)
func main() {
if err := tm.Toast("Hello World!", tm.ToastOption{
FontColor: "#FF0000",
Position: tm.Top,
Short: true,
BGColor: "#00FF00",
}); err != nil {
panic(err)
}
}
```