Skip to content

Power Profiles

Library and CLI tool for monitoring upowerd powerprofiles.

Installation

  1. install dependencies
sh
sudo pacman -Syu meson vala json-glib gobject-introspection
sh
sudo dnf install meson gcc valac json-glib-devel gobject-introspection-devel
sh
sudo apt install meson valac libjson-glib-dev 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.

  1. clone repo
sh
git clone https://github.com/aylur/astal.git
cd astal/lib/powerprofiles
  1. install
sh
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:

sh
meson setup --prefix /usr build

Usage

You can browse the PowerProfiles reference.

CLI

sh
astal-power-profiles --help

Library

js
import PowerProfiles from "gi://AstalPowerProfiles"

const powerprofiles = PowerProfiles.get_default()

print(powerprofiles.activeProfile)
py
from gi.repository import AstalPowerProfiles as PowerProfiles

powerprofiles = PowerProfiles.get_default()

print(powerprofiles.get_active_profile())
lua
local PowerProfiles = require("lgi").require("AstalPowerProfiles")

local powerprofiles = PowerProfiles.get_default()

print(powerprofiles.active_profile)
vala
// Not yet documented