components

package
v0.0.0-...-885c034 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DrawReset = "^d^"
)

Variables

View Source
var (
	BatteryPath    = "/sys/class/power_supply"
	BatteryPerfect = drawColor("")
	BatteryGood    = drawColor("#00ff00")
	BatteryOkay    = drawColor("#ffff00")
	BatteryBad     = drawColor("#ff8800")
	BatteryDead    = drawColor("#ff0000")
)
View Source
var (
	CPUPath              = "/proc/stat"
	CPUFile              *os.File
	CPUData              = make([]CPUDataStore, CPUCores+1)
	CPUBarWidth          = 5
	CPUBarBackground     = "^c#000000^"
	CPUBarForeground     = "^c#ff0000^"
	CPUBarDrawBackground = fmt.Sprintf("^r0,1,%d,%d^^f%d^", CPUBarWidth, BarHeight, CPUBarWidth+2*BarPadding)
	CPUBarDrawForeground = fmt.Sprintf("^r0,%s,%d,%s^^f%d^", "%d", CPUBarWidth, "%d", CPUBarWidth+2*BarPadding)
	CPUBARDrawLast       = fmt.Sprintf("^f%d^^d^", -2*BarPadding)
)
View Source
var (
	FilesystemPath  = "/proc/mounts"
	FilesystemUnits = []string{
		"B", "KB", "MB", "GB", "TB",
	}
)
View Source
var (
	MemoryPath              = "/proc/meminfo"
	MemoryFile              *os.File
	MemoryBarWidth          = 40
	MemoryBarForeground     = "#0000ff"
	MemoryBarBackground     = "#000000"
	MemoryBarDrawBackground = fmt.Sprintf("^c%s^^r0,%d,%d,%d^", MemoryBarBackground, BarPadding, MemoryBarWidth, BarHeight)
	MemoryBarDrawForeground = fmt.Sprintf("^c%s^^r0,%d,%s,%d^^f%d^^d^", MemoryBarForeground, BarPadding, "%d", BarHeight, MemoryBarWidth)
	MemoryBarDraw           = MemoryBarDrawBackground + MemoryBarDrawForeground
	MemoryUnits             = []string{"KB", "MB", "GB"}
	MemoryData              = map[string]int{
		"MemTotal":     0,
		"MemFree":      0,
		"Shmem":        0,
		"Buffers":      0,
		"Cached":       0,
		"SReclaimable": 0,
	}
)
View Source
var (
	NetworkPath  = "/proc/net/dev"
	NetworkFile  *os.File
	NetworkData  = make(map[string]*NetworkDataStore)
	NetworkUnits = []string{"KB", "MB"}
)
View Source
var (
	PulseaudioCore   *pulseaudio.Object
	PulseaudioClient *PulseaudioClientStruct
	PulseaudioState  = new(PulseaudioStateStruct)
)
View Source
var (
	SoundUpdate          func(string)
	SoundPulseaudioState = NewSoundPulseaudioState()
	SoundMPDState        = NewSoundMPDState()
	SoundMPRISState      = NewSoundMPRISState()
	SoundStates          = SoundStatesStruct{
							// contains filtered or unexported fields
	}
)
View Source
var (
	SoundMPRISMatchPlayer = "" /* 152-byte string literal not displayed */
	SoundMPRISMatchStream = "" /* 155-byte string literal not displayed */
)
View Source
var (
	ThermalInputPattern = regexp.MustCompile(`^temp[0-9]+_input$`)
	ThermalPath         = "/sys/class/hwmon/"
	ThermalPerfect      = drawColor("")
	ThermalCold         = drawColor("#0000ff")
	ThermalGood         = drawColor("#00ff00")
	ThermalOkay         = drawColor("#ffff00")
	ThermalBad          = drawColor("#ff0000")
)
View Source
var (
	SoundMPDCommand = []byte("command_list_ok_begin\nstatus\ncurrentsong\nidle player\ncommand_list_end\n")
)

Functions

func Battery

func Battery(_ int64) string

func CPUPercentBar

func CPUPercentBar(_ int64) string

func CurrentTime

func CurrentTime(_ int64) string

func Filesystem

func Filesystem(_ int64) string

func Memory

func Memory(_ int64) string

func Network

func Network(interval int64) string

func Pulseaudio

func Pulseaudio(update func(string))

func Solaar

func Solaar(_ int64) string

func Sound

func Sound(update func(string))

func Thermal

func Thermal(_ int64) string

func Uptime

func Uptime(_ int64) string

Types

type Async

type Async = func(channel func(string))

type Basic

type Basic = func(interval int64) string

type CPUDataStore

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

type NetworkDataStore

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

type PulseaudioClientStruct

type PulseaudioClientStruct struct {
	*pulseaudio.Client
}

func (*PulseaudioClientStruct) DeviceActivePortUpdated

func (cl *PulseaudioClientStruct) DeviceActivePortUpdated(path dbus.ObjectPath, port dbus.ObjectPath)

func (*PulseaudioClientStruct) DeviceMuteUpdated

func (cl *PulseaudioClientStruct) DeviceMuteUpdated(path dbus.ObjectPath, muted bool)

func (*PulseaudioClientStruct) DeviceVolumeUpdated

func (cl *PulseaudioClientStruct) DeviceVolumeUpdated(path dbus.ObjectPath, values []uint32)

func (*PulseaudioClientStruct) NewPlaybackStream

func (cl *PulseaudioClientStruct) NewPlaybackStream(path dbus.ObjectPath)

func (*PulseaudioClientStruct) NewSink

func (cl *PulseaudioClientStruct) NewSink(_ dbus.ObjectPath)

func (*PulseaudioClientStruct) PlaybackStreamRemoved

func (cl *PulseaudioClientStruct) PlaybackStreamRemoved(path dbus.ObjectPath)

func (*PulseaudioClientStruct) SinkRemoved

func (cl *PulseaudioClientStruct) SinkRemoved(_ dbus.ObjectPath)

type PulseaudioStateStruct

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

func (*PulseaudioStateStruct) Headphones

func (ps *PulseaudioStateStruct) Headphones() bool

func (*PulseaudioStateStruct) Icon

func (ps *PulseaudioStateStruct) Icon() string

func (*PulseaudioStateStruct) Muted

func (ps *PulseaudioStateStruct) Muted(muted bool)

func (*PulseaudioStateStruct) Port

func (ps *PulseaudioStateStruct) Port(port dbus.ObjectPath)

func (*PulseaudioStateStruct) Reset

func (ps *PulseaudioStateStruct) Reset()

func (*PulseaudioStateStruct) Update

func (ps *PulseaudioStateStruct) Update()

func (*PulseaudioStateStruct) Volume

func (ps *PulseaudioStateStruct) Volume(values []uint32)

type SoundMPDStateStruct

type SoundMPDStateStruct struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func NewSoundMPDState

func NewSoundMPDState() *SoundMPDStateStruct

func (*SoundMPDStateStruct) Connect

func (ms *SoundMPDStateStruct) Connect()

func (*SoundMPDStateStruct) Connected

func (ms *SoundMPDStateStruct) Connected() bool

func (*SoundMPDStateStruct) Current

func (ms *SoundMPDStateStruct) Current() (string, string, string)

func (*SoundMPDStateStruct) Disconnected

func (ms *SoundMPDStateStruct) Disconnected() bool

func (*SoundMPDStateStruct) Has

func (ms *SoundMPDStateStruct) Has(key string) bool

func (*SoundMPDStateStruct) IsActive

func (ms *SoundMPDStateStruct) IsActive() bool

func (*SoundMPDStateStruct) Parse

func (ms *SoundMPDStateStruct) Parse(data []byte)

func (*SoundMPDStateStruct) Reset

func (ms *SoundMPDStateStruct) Reset()

func (*SoundMPDStateStruct) Set

func (ms *SoundMPDStateStruct) Set(key, value string)

func (*SoundMPDStateStruct) Update

func (ms *SoundMPDStateStruct) Update()

type SoundMPRISStateStruct

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

func NewSoundMPRISState

func NewSoundMPRISState() *SoundMPRISStateStruct

func (*SoundMPRISStateStruct) Current

func (ms *SoundMPRISStateStruct) Current() (string, string, string)

func (*SoundMPRISStateStruct) IsActive

func (ms *SoundMPRISStateStruct) IsActive() bool

func (*SoundMPRISStateStruct) Metadata

func (ms *SoundMPRISStateStruct) Metadata(data dbus.Variant)

func (*SoundMPRISStateStruct) State

func (ms *SoundMPRISStateStruct) State(state dbus.Variant)

func (*SoundMPRISStateStruct) Stream

func (ms *SoundMPRISStateStruct) Stream(data dbus.Variant)

type SoundPulseaudioStateStruct

type SoundPulseaudioStateStruct struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func NewSoundPulseaudioState

func NewSoundPulseaudioState() *SoundPulseaudioStateStruct

func (*SoundPulseaudioStateStruct) AddStream

func (ps *SoundPulseaudioStateStruct) AddStream(path dbus.ObjectPath)

func (*SoundPulseaudioStateStruct) Current

func (ps *SoundPulseaudioStateStruct) Current() (string, string, string)

func (*SoundPulseaudioStateStruct) Icons

func (ps *SoundPulseaudioStateStruct) Icons() []string

func (*SoundPulseaudioStateStruct) IsActive

func (ps *SoundPulseaudioStateStruct) IsActive() bool

func (*SoundPulseaudioStateStruct) RemoveStream

func (ps *SoundPulseaudioStateStruct) RemoveStream(path dbus.ObjectPath)

type SoundState

type SoundState interface {
	Current() (string, string, string)
	IsActive() bool
}

type SoundStatesStruct

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

func (*SoundStatesStruct) Current

func (sss *SoundStatesStruct) Current() (string, string, string)

func (*SoundStatesStruct) Icons

func (sss *SoundStatesStruct) Icons(current string) []string

func (*SoundStatesStruct) Output

func (sss *SoundStatesStruct) Output() string

func (*SoundStatesStruct) Player

func (sss *SoundStatesStruct) Player(player string) string

func (*SoundStatesStruct) State

func (sss *SoundStatesStruct) State(state string) string

func (*SoundStatesStruct) Title

func (sss *SoundStatesStruct) Title(title, state string) string

Jump to

Keyboard shortcuts

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