powerprofiles

package
v0.3.22 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 9 Imported by: 1 module, 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 powerprofiles is the power-profiles-daemon client: the active profile, the available set, property-change ticks, and the cycle action.

Index

Constants

View Source
const (
	ServiceName = "dev.stubbe.lys.PowerProfiles1"
	ServicePath = dbus.ObjectPath("/dev/stubbe/lys/PowerProfiles")
)

lys-shell's own interface over the service, which `lys-shell power` drives (wayle-power-profiles/src/dbus).

View Source
const (
	ProfilePowerSaver  = "power-saver"
	ProfileBalanced    = "balanced"
	ProfilePerformance = "performance"
)

Profile names as the daemon spells them.

View Source
const (
	// BusName is power-profiles-daemon's well-known name on the system bus.
	BusName = "org.freedesktop.UPower.PowerProfiles"
)

Variables

This section is empty.

Functions

func NextProfile

func NextProfile(current string, available []string) string

NextProfile is helpers.rs's next_profile: the successor of current in the canonical order restricted to available (empty available means all three), falling back to balanced.

func ServeDaemon

func ServeDaemon(conn *dbus.Conn, src Source) (func(), error)

ServeDaemon exports the interface for the service over src. Like the Rust builder it is only served when power-profiles-daemon answered: without it the CLI reports the service as not running.

Types

type Daemon

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

Daemon is the dev.stubbe.lys.PowerProfiles1 object (PowerProfilesDaemon).

func (*Daemon) Cycle

func (d *Daemon) Cycle() *dbus.Error

Cycle advances to the next profile.

func (*Daemon) ListProfiles

func (d *Daemon) ListProfiles() ([]string, *dbus.Error)

ListProfiles names the available profiles.

func (*Daemon) SetProfile

func (d *Daemon) SetProfile(profile string) *dbus.Error

SetProfile switches to a named profile.

type Snapshot

type Snapshot struct {
	Available bool
	Active    string
	Profiles  []string
	// PerformanceDegraded is the daemon's degradation reason ("" when
	// performance is not degraded).
	PerformanceDegraded string
}

Snapshot is one daemon state.

type Source

type Source interface {
	// Read collects the snapshot.
	Read(ctx context.Context) (Snapshot, error)
	// SetActive switches the profile.
	SetActive(ctx context.Context, profile string) error
	// Subscribe ticks on daemon property changes. The channel closes
	// when ctx completes; stop terminates the listener.
	Subscribe(ctx context.Context) (<-chan struct{}, func(), error)
}

Source is the module's seam.

type System

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

System reads the real daemon over the system bus.

func NewOn added in v0.3.14

func NewOn(conn *dbus.Conn) *System

NewOn reads the daemon over conn, which stays the caller's.

func (*System) Read

func (s *System) Read(ctx context.Context) (Snapshot, error)

Read collects the snapshot; an absent daemon reads as unavailable with the canonical cycle available.

func (*System) SetActive

func (s *System) SetActive(ctx context.Context, profile string) error

SetActive writes the ActiveProfile property.

func (*System) Subscribe

func (s *System) Subscribe(ctx context.Context) (<-chan struct{}, func(), error)

Subscribe matches the daemon's PropertiesChanged.

Jump to

Keyboard shortcuts

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