Documentation
¶
Index ¶
- func BeforeRestart(callback func())
- func BoolPtr(value bool) *bool
- func CloseFileBeforeRestart(file *os.File)
- func IntPtr(value int) *int
- func RedirectStderr(filename string)
- func Restart()
- type APCUPSDStatus
- type Alignment
- type CPU
- type CPUColors
- type ClickEvent
- type ClickableWidget
- type Config
- type Edit
- type FuncWidget
- type Markup
- type Memory
- type NvidiaTemperature
- type ProcFile
- type Separator
- type StatusBlock
- type Switcher
- type Temperature
- type Time
- type Widget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeforeRestart ¶
func BeforeRestart(callback func())
BeforeRestart adds callback to a list of methods to be called before the application is restarted
func CloseFileBeforeRestart ¶
CloseFileBeforeRestart marks the file to be closed in case of a Restart This is logically similar to `BeforeRestart(func(){file.Close()}), though more efficient
func RedirectStderr ¶
func RedirectStderr(filename string)
RedirectStderr makes all writes to stderr go to the passed file. The file is always opened in append mode
Types ¶
type APCUPSDStatus ¶
type APCUPSDStatus struct { Host string Interval time.Duration // contains filtered or unexported fields }
func (*APCUPSDStatus) Status ¶
func (a *APCUPSDStatus) Status() (StatusBlock, error)
type Alignment ¶
type Alignment string
Alignment controls the direction to float the text AlignLeft is the default
type CPU ¶
type CPU struct { Colors *CPUColors // How many chars wide to be Width int // How long the immediate cpu counter should be, or zero for off ShortInterval time.Duration Show1 bool Show5 bool Show15 bool // contains filtered or unexported fields }
func (*CPU) Status ¶
func (c *CPU) Status() (StatusBlock, error)
type CPUColors ¶
type CPUColors struct { User string Nice string System string Idle string IOWait string IRQ string SoftIRQ string Steal string Guest string GuestNice string Other string }
func HTOPAdvancedCPUColors ¶
func HTOPAdvancedCPUColors() *CPUColors
type ClickEvent ¶
type ClickEvent struct { // X11 root window coordinates where the click occurred X int `json:"x"` Y int `json:"y"` // X11 button ID (for example 1 to 3 for left/middle/right mouse button) Button int `json:"button"` // Coordinates where the click occurred, with respect to the top left corner // of the block RelativeX int `json:"relative_x"` RelativeY int `json:"relative_y"` // Width and height (in px) of the block Width int `json:"width"` Height int `json:"height"` // An array of the modifiers active when the click occurred. The order in // which modifiers are listed is not guaranteed. Modifiers []string `json:"modifiers"` }
A ClickEvent is fired when the user interacts with a specific ClickableWidget
type ClickableWidget ¶
type ClickableWidget interface { Widget Click(ClickEvent) bool }
A ClickableWidget is a Widget that can receive ClickEvents
type Config ¶
type Config struct { // Widgets contains all Widgets to be rendered, left to right Widgets []Widget // The DefaultSeparator is used when a Widget does not provide it's // own Separator DefaultSeparator Separator // If false, watch the binary for changes and restart if it is changed. This // restarts the binary in place, and can leak fds opened by other packages. DontWatchBinary bool // How often to update the bar. If unset 1 second is used Interval time.Duration }
type Edit ¶
type Edit struct { Widget Widget Func func(*StatusBlock) }
Edit allows you to override fields from a child Widget's StatusBlocks Widget may be a ClickableWidget
func (*Edit) Click ¶
func (e *Edit) Click(c ClickEvent) bool
func (*Edit) Status ¶
func (e *Edit) Status() (StatusBlock, error)
type FuncWidget ¶
type FuncWidget func() (StatusBlock, error)
The FuncWidget type is an adapter to use a normal function as a non-ClickableWidget
func (FuncWidget) Status ¶
func (w FuncWidget) Status() (StatusBlock, error)
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory displays the amount of Memory Available/Total in gb
func (*Memory) Status ¶
func (m *Memory) Status() (StatusBlock, error)
type NvidiaTemperature ¶
type NvidiaTemperature struct { Format string // contains filtered or unexported fields }
func (*NvidiaTemperature) Status ¶
func (t *NvidiaTemperature) Status() (StatusBlock, error)
type Separator ¶
type Separator struct { // Hide specifies whether a separator line should be drawn after this block. // The default is false, meaning the separator line will be drawn. Note that // if you disable the separator line, there will still be a gap after the // block, unless you also use Width. Hide *bool // Width controls the amount of pixels to leave blank after the block. In the // middle of this gap, a separator line will be drawn unless separator is // disabled. Normally, you want to set this to an odd value (the default is // 9 pixels), since the separator line is drawn in the middle. Width *int }
type StatusBlock ¶
type StatusBlock struct { // The FullText will be displayed by i3bar on the status line. // This is the only required key. If full_text is an empty string, // the block will be skipped. FullText string // ShortText will be used in case the status line needs to be shortened // because it uses more space than your screen provides. For example, when // displaying an IPv6 address, the prefix is usually (!) more relevant than // the suffix, because the latter stays constant when using autoconf, while // the prefix changes. When displaying the date, the time is more important // than the date (it is more likely that you know which day it is than what // time it is). ShortText string // To make the current state of the information easy to spot, colors can be // used. For example, the wireless block could be displayed in red if the // card is not associated with any network and in green or yellow (depending // on the signal strength) when it is associated. Color color.Color // Background overrides the background color for this particular block. Background color.Color // Overrides the border color for this particular block. Border color.Color // The minimum width (in pixels) of the block. If the content of the FullText // field take less space than the specified min_width, the block will be // padded to the left and/or the right side, according to the align key. This // is useful when you want to prevent the whole status line to shift when //value take more or less space between each iteration. The value can also be // a string. In this case, the width of the text given by min_width determines // the minimum width of the block. This is useful when you want to set a // sensible minimum width regardless of which font you are using, and at what // particular size. MinWidth int // Align text on the center, right or left (default) of the block, when the // minimum width of the latter, specified by the min_width key, is not reached. Align Alignment // Urgent specifies whether the current value is urgent. Examples are battery // charge values below 1 percent or no more available disk space (for non-root // users). The presentation of urgency is up to i3bar. Urgent bool // Markup indicates how the text of the block should be parsed. // Pango markup only works if you use a pango font. Markup Markup // Separator optionally controls the space after this Widget. If unset the // DefaultSeparator will be used Separator Extra map[string]interface{} }
StatusBlock is a block that is rendered by i3bar
func (StatusBlock) Status ¶
func (s StatusBlock) Status() (StatusBlock, error)
type Switcher ¶
type Switcher []Widget
Switcher switches between it's constituent widgets when clicked on
func (Switcher) Click ¶
func (s Switcher) Click(c ClickEvent) bool
func (Switcher) Status ¶
func (s Switcher) Status() (StatusBlock, error)
type Temperature ¶
type Temperature struct { Path string Divisor float64 Format string // contains filtered or unexported fields }
Reads a file off disk, parses it as an int, then formats that Typically this is used for temperature sensors in /sys/
func (*Temperature) Status ¶
func (t *Temperature) Status() (StatusBlock, error)
type Time ¶
type Time struct { // Full width format specifier; see time.Format Format string ShortFormat string // Name of the timezone to use LocationName string Location *time.Location }
Time is a Widget that renders a Clock
func (*Time) Status ¶
func (t *Time) Status() (StatusBlock, error)
type Widget ¶
type Widget interface {
Status() (StatusBlock, error)
}
Widget provides StatusBlocks to the i3bar