power

package
v0.0.0-...-9c5270f Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

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

type ManagedDevice struct {
	Attributes map[string]string
}

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

func NewManagedDevice

func NewManagedDevice() *ManagedDevice

func (*ManagedDevice) Add

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

func (manDev *ManagedDevice) BatteryPercent() int64

BatteryPercent returns the percent of the device battery

func (*ManagedDevice) BluetoothDevice

func (manDev *ManagedDevice) BluetoothDevice() bool

BluetoothDevice returns whether or not the device supports bluetooth

func (*ManagedDevice) BuiltIn

func (manDev *ManagedDevice) BuiltIn() bool

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

func (*ManagedDevice) Dump

func (manDev *ManagedDevice) Dump() string

Dump writes out all the device attributes as a single string

func (*ManagedDevice) HasBattery

func (manDev *ManagedDevice) HasBattery() bool

HasBattery returns whether or not the device has a battery

func (*ManagedDevice) Product

func (manDev *ManagedDevice) Product() string

Product returns the name of the device

type ManagedDevices

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

ManageDevices are ...

func NewManagedDevices

func NewManagedDevices() *ManagedDevices

func (*ManagedDevices) Refresh

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