termux

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

README

go-termux

API Documentation

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
package main

import (
        "fmt"

        tm "github.com/stunnel/termux/pkg/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
package main

import tm "github.com/stunnel/termux/pkg/termux"

func main() {
    if err := tm.ClipboardSet("ummmm"); err != nil {
        panic(err)
    }
}
Displays a short toast
package main

import (
        tm "github.com/stunnel/termux/pkg/termux"
)

func main() {
        if err := tm.Toast("Hello World!", tm.ToastOption{
                FontColor: "#FF0000",
                Position:  tm.Top,
                Short:     true,
                BGColor:   "#00FF00",
        }); err != nil {
                panic(err)
        }
}

Documentation

Overview

Package termux implements termux:API calls and wraps them into golang function calls.

Example:
package main

import tm "github.com/stunnel/termux/pkg/termux"

func main() {
	if err := tm.ClipboardSet("ummmm"); err != nil {
		panic(err)
	}
}

We call termux:API methods directly so that this package would work without termux-api package installed.

Directories

Path Synopsis
cmd
internal
api
io
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL