|
All checks were successful
/ build (push) Successful in 12s
/ compile-x86_64-pc-windows-msvc (push) Successful in 36s
/ compile-aarch64-unknown-linux-gnu (push) Successful in 48s
/ compile-riscv64gc-unknown-linux-gnu (push) Successful in 44s
/ compile-aarch64-apple-darwin (push) Successful in 20s
/ compile-x86_64-apple-darwin (push) Successful in 20s
/ compile-x86_64-unknown-linux-gnu (push) Successful in 42s
/ compile-aarch64-pc-windows-msvc (push) Successful in 37s
/ compile-loongarch64-unknown-linux-gnu (push) Successful in 44s
/ lint (push) Successful in 23s
Signed-off-by: Lilly Rose Berner <lilly@lostluma.net> |
||
|---|---|---|
| .cargo | ||
| .forgejo/workflows | ||
| gradle | ||
| src/main | ||
| .gitignore | ||
| build.gradle.kts | ||
| Cargo.lock | ||
| Cargo.toml | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| LICENSE | ||
| README.md | ||
| settings.gradle.kts | ||
Battery
Library for querying system battery information.
A Java 8+ JNI wrapper for the starship battery crate.
Usage
To get started create a Manager instance and query it for information:
try (Manager manager = Manager.create()) {
for (Battery battery : manager.batteries()) {
// Query battery for its information here
Optional<Duration> timeToEmpty = battery.timeToEmpty();
}
}
For more detailed information consult the documentation attached to all types in the api package.
Installation
The library can be installed from the releases repository on maven.lostluma.net in two variants:
default: Downloads, validates, and caches the dynamic library on demand. Saves bandwidth and disk space.bundled: Contains the dynamic library for all platforms. Recommended if first application startup may be offline.
Releases starting with version 2.0.0 are signed using PGP key 831BD989D1B19DBF15DB58A6D99A97B69E896870.
The dynamic library comes prebuilt for the following platforms:
| aarch64 | amd64 | riscv64 | loongarch64 | |
|---|---|---|---|---|
| Linux | yes | yes | yes | yes |
| MacOS | yes | yes | ||
| Windows | yes | yes |
For running on other platforms see the Behavior Customization section below.
Behavior Customization
Some library behavior may be controlled using system properties or the Library utility class:
battery.natives.cache.dir: Use a different storage location for cached filesbattery.natives.download: Controls automatic backing library download for thedefaultvariantbattery.natives.path: Provide your own build of the backing library for usage on more platforms
Values overwritten using system properties will take precedence over those set via the Library class.