power

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package power provides power state detection functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LidEvent added in v1.3.0

type LidEvent struct {
	State LidState
}

type LidState added in v1.3.0

type LidState int
const (
	UnknownLidState LidState = iota
	OpenedLidState
	ClosedLidState
)

func (LidState) String added in v1.3.0

func (p LidState) String() string

type LidStateDetector added in v1.3.0

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

func NewLidStateDetector added in v1.3.0

func NewLidStateDetector(ctx context.Context, cfg *config.Config, conn *dbus.Conn, enableLidEvents bool) (*LidStateDetector, error)

func (*LidStateDetector) GetCurrentState added in v1.3.0

func (l *LidStateDetector) GetCurrentState() LidState

func (*LidStateDetector) Listen added in v1.3.0

func (l *LidStateDetector) Listen() <-chan LidEvent

func (*LidStateDetector) Reload added in v1.3.0

func (l *LidStateDetector) Reload(ctx context.Context) error

func (*LidStateDetector) Run added in v1.3.0

func (l *LidStateDetector) Run(ctx context.Context) error

type PowerDetector

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

func NewPowerDetector

func NewPowerDetector(ctx context.Context, cfg *config.Config, conn *dbus.Conn, disablePowerEvents bool) (*PowerDetector, error)

func (*PowerDetector) GetCurrentState

func (p *PowerDetector) GetCurrentState() PowerState

func (*PowerDetector) Listen

func (p *PowerDetector) Listen() <-chan PowerEvent

func (*PowerDetector) Reload

func (p *PowerDetector) Reload(ctx context.Context) error

func (*PowerDetector) Run

func (p *PowerDetector) Run(ctx context.Context) error

type PowerEvent

type PowerEvent struct {
	State PowerState
}

type PowerState

type PowerState int
const (
	UnknownPowerState PowerState = iota
	BatteryPowerState
	ACPowerState
)

func (PowerState) String

func (p PowerState) String() string

Jump to

Keyboard shortcuts

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