mirror of
https://github.com/zoriya/astal.git
synced 2026-05-24 15:08:18 +00:00
1.6 KiB
1.6 KiB
Battery
Library and CLI tool for monitoring upowerd devices.
Installation
- install dependencies
:::code-group
sudo pacman -Syu meson vala gobject-introspection
sudo dnf install meson gcc valac gobject-introspection-devel
sudo apt install meson valac gobject-introspection
:::
::: info Although UPower is not a direct build dependency, it should be self-explanatory that the daemon is required to be available at runtime. :::
- clone repo
git clone https://github.com/aylur/astal.git
cd astal/lib/battery
- install
meson setup build
meson install -C build
:::tip
Most distros recommend manual installs in /usr/local,
which is what meson defaults to. If you want to install to /usr
instead which most package managers do, set the prefix option:
meson setup --prefix /usr build
:::
Usage
You can browse the Battery reference.
CLI
astal-battery --help
Library
:::code-group
import Battery from "gi://AstalBattery";
const battery = Battery.get_default()
console.log(battery.percentage)
# Not yet documented
-- Not yet documented
// Not yet documented
:::