uber

package
v0.0.4-0...-7259d3a Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: GPL-3.0 Imports: 1 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Name     string
	Instance string
	Button   int
	X        int
	Y        int
}

event passed from X/status bar manager

type Plugin

type Plugin interface {
	// Init() is called before main loop is run.
	// Error here will stop the main program from running so it is a good place to run any validation
	// of config or environment you need
	// Plugin should run any validation checks it needs in that function and return error if it fails, it is also good place to do stuff like precompiling templates (especially if they can be wrong from user input)
	// It is also good place to run any background goroutines plugin needs
	Init() error
	// UpdatePeriodic will run on each tick of timer in interval specified, and also will be run once to pre-populate  data
	// note that any switch-state handling (like displaying different kind of message when you click it) is still on plugin to do
	// This have to return state, even if it was previous one
	// It *can* delay for longer than interval,  engine will run at most one UpdatePeriodic(), but any long-term/heavy data gathering should be run out of separate goroutine started in Init()
	//
	UpdatePeriodic() Update
	// UpdateFromEvent is ran on each user-initiated event. If for some reason update can't be generated or doesn't make sense, return empty update
	UpdateFromEvent(Event) Update
	// GetUpdateInterval returns interval in milliseconds that will be used to run UpdatePeriodic() function by main gor
	// return < 1 if you do not want UpdatePeriodic to be run.
	// Normally it should just return interval in config, however in some cases you might want to limit it, for example, updating disk space every 100ms might not be very useful
	GetUpdateInterval() int
}

Plugin interface

type PluginConfig

type PluginConfig struct {
	Config config.PluginConfig
	Update chan Update // chan to send panel updates
}

type Tag

type Tag struct {
	Name     string
	Instance string
}

type TaggedUpdate

type TaggedUpdate struct {
	Update *Update
	Tag    *Tag
}

type Trigger

type Trigger int8

type Update

type Update struct {
	Name            string
	Instance        string
	FullText        string // full text, when shortening is not required
	ShortText       string // shortened version of text to use when bar is full
	Color           string // color in #ffff00
	BackgroundColor string // color in #ffff00
	BorderColor     string // color in #ffff00
	Markup          string // markup, so far only pango in i3bar is supported
	Urgent          bool   `json:"urgent"` // urgent flag, will update (assuming backend allows) immediately if that flag is present
}

update sent by plugin

Jump to

Keyboard shortcuts

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