Skip to content

package power

import "kaijuengine.com/platform/power"

Types

Source

int

type Source int

Source is the currently detected system power source.

const ( SourceUnknown Source = iota SourceAC SourceBattery )

Status

struct

type Status struct {
    Source         Source
    HasBattery     bool
    BatteryPercent int
}

Status is a snapshot of the system power state.

Query

func Query() (Status, error)

Status.OnBattery

func (s Status) OnBattery() bool

OnBattery returns true when the machine is currently running on battery.