power

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MPL-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Battery

type Battery struct {
	Charge    string
	Remaining string
	// contains filtered or unexported fields
}

func NewBattery

func NewBattery() *Battery

func (*Battery) Refresh

func (battery *Battery) Refresh()

func (*Battery) String

func (battery *Battery) String() string

type ManagedDevice added in v0.40.0

type ManagedDevice struct {
	Attributes map[string]string
}

ManagedDevice represents an entry in the output returned by ioreg when passed AppleDeviceManagementHIDEventService

func NewManagedDevice added in v0.40.0

func NewManagedDevice() *ManagedDevice

func (*ManagedDevice) Add added in v0.40.0

func (manDev *ManagedDevice) Add(chunk string)

Add takes a chunk of raw text and attempts to parse it as managed device data and create an attribute map from it.

	A typical chunk will look like:

		"LowBatteryNotificationPercentage" = 2
      	"BatteryFaultNotificationType" = "TPBatteryFault"
      	...
      	"VersionNumber" = 0

	which should become:

		{
			"LowBatteryNotificationPercentage": 2,
			"BatteryFaultNotificationType": "TPBatteryFault",
			"VersionNumber": 0,
		}

func (*ManagedDevice) BatteryPercent added in v0.40.0

func (manDev *ManagedDevice) BatteryPercent() int64

BatteryPercent returns the percent of the device battery

func (*ManagedDevice) BluetoothDevice added in v0.40.0

func (manDev *ManagedDevice) BluetoothDevice() bool

BluetoothDevice returns whether or not the device supports bluetooth

func (*ManagedDevice) BuiltIn added in v0.40.0

func (manDev *ManagedDevice) BuiltIn() bool

BuiltIn returns whether or not the device is built into the computer

func (*ManagedDevice) Dump added in v0.40.0

func (manDev *ManagedDevice) Dump() string

Dump writes out all the device attributes as a single string

func (*ManagedDevice) HasBattery added in v0.40.0

func (manDev *ManagedDevice) HasBattery() bool

HasBattery returns whether or not the device has a battery

func (*ManagedDevice) Product added in v0.40.0

func (manDev *ManagedDevice) Product() string

Product returns the name of the device

type ManagedDevices added in v0.40.0

type ManagedDevices struct {
	Devices []*ManagedDevice
	// contains filtered or unexported fields
}

ManageDevices are ...

func NewManagedDevices added in v0.40.0

func NewManagedDevices() *ManagedDevices

func (*ManagedDevices) Refresh added in v0.40.0

func (manDevices *ManagedDevices) Refresh()

type Settings

type Settings struct {
	*cfg.Common
}

func NewSettingsFromYAML

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings

type Widget

type Widget struct {
	view.TextWidget

	Battery        *Battery
	ManagedDevices *ManagedDevices
	// contains filtered or unexported fields
}

func NewWidget

func NewWidget(tviewApp *tview.Application, redrawChan chan bool, settings *Settings) *Widget

func (*Widget) Refresh

func (widget *Widget) Refresh()

Jump to

Keyboard shortcuts

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