profiles

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package profiles talks to power-profiles-daemon over the system bus, and decides which profile belongs on which power source.

Index

Constants

This section is empty.

Variables

View Source
var ErrAbsent = errors.New("power-profiles-daemon not found on the system bus")

ErrAbsent reports that power-profiles-daemon is not on the system bus, which callers treat as "profile handling unavailable", not as a fault.

Functions

func Pick

func Pick(available []string, onAC bool) string

Pick returns the profile to activate for the given power source: full performance on AC, power-saver on battery, each falling back to balanced when unavailable. An empty available set yields "", meaning "nothing to do"; ppd always offers balanced, so that case only means ppd is absent.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to power-profiles-daemon over a caller-owned bus connection. The daemon is located on first use and again after it disappears, so a ppd that starts late or restarts is picked up without reconnecting.

func New

func New(conn *dbus.Conn) *Client

New returns a client on conn; it does no I/O until first used.

func (*Client) Active

func (c *Client) Active() (string, error)

Active returns the name of the active profile.

func (*Client) Available

func (c *Client) Available() ([]string, error)

Available lists the profiles ppd offers.

func (*Client) Set

func (c *Client) Set(name string) error

Set activates the named profile. SetProperty passes the value through as-is, so the variant org.freedesktop.DBus.Properties.Set expects is made here; a raw string makes ppd reject the whole call.

Jump to

Keyboard shortcuts

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