ygs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ygs contains the YaGoStatus structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterWidget

func RegisterWidget(name string, newFunc newWidgetFunc, defaultParams interface{})

RegisterWidget registers widget.

Types

type I3BarBlock

type I3BarBlock struct {
	FullText            string          `json:"full_text,omitempty"`
	ShortText           string          `json:"short_text,omitempty"`
	Color               string          `json:"color,omitempty"`
	BorderColor         string          `json:"border,omitempty"`
	BorderTop           *uint16         `json:"border_top,omitempty"`
	BorderBottom        *uint16         `json:"border_bottom,omitempty"`
	BorderLeft          *uint16         `json:"border_left,omitempty"`
	BorderRight         *uint16         `json:"border_right,omitempty"`
	BackgroundColor     string          `json:"background,omitempty"`
	Markup              string          `json:"markup,omitempty"`
	MinWidth            string          `json:"min_width,omitempty"`
	Align               string          `json:"align,omitempty"`
	Name                string          `json:"name,omitempty"`
	Instance            string          `json:"instance,omitempty"`
	Urgent              bool            `json:"urgent,omitempty"`
	Separator           *bool           `json:"separator,omitempty"`
	SeparatorBlockWidth uint16          `json:"separator_block_width,omitempty"`
	Custom              map[string]Vary `json:"-"`
}

I3BarBlock represents a block of i3bar message.

func (*I3BarBlock) Apply added in v1.0.0

func (b *I3BarBlock) Apply(tpl I3BarBlock)

func (I3BarBlock) Env added in v1.0.0

func (b I3BarBlock) Env(suffix string) []string

func (*I3BarBlock) FromJSON added in v1.0.0

func (b *I3BarBlock) FromJSON(data []byte, strict bool) error

func (I3BarBlock) MarshalJSON

func (b I3BarBlock) MarshalJSON() ([]byte, error)

MarshalJSON marshals json with custom keys (with _ prefix).

func (*I3BarBlock) ToVaryMap added in v1.0.0

func (b *I3BarBlock) ToVaryMap() map[string]Vary

func (*I3BarBlock) UnmarshalJSON

func (b *I3BarBlock) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals json with custom keys (with _ prefix).

type I3BarClickEvent

type I3BarClickEvent struct {
	Name      string   `json:"name,omitempty"`
	Instance  string   `json:"instance,omitempty"`
	Button    uint8    `json:"button"`
	X         uint16   `json:"x"`
	Y         uint16   `json:"y"`
	RelativeX uint16   `json:"relative_x"`
	RelativeY uint16   `json:"relative_y"`
	Width     uint16   `json:"width"`
	Height    uint16   `json:"height"`
	Modifiers []string `json:"modifiers"`
}

I3BarClickEvent represents a user click event message.

type I3BarHeader

type I3BarHeader struct {
	Version     uint8 `json:"version"`
	StopSignal  int   `json:"stop_signal,omitempty"`
	ContSignal  int   `json:"cont_signal,omitempty"`
	ClickEvents bool  `json:"click_events,omitempty"`
}

I3BarHeader represents the header of an i3bar message.

type Vary added in v1.0.0

type Vary []byte

func (Vary) MarshalJSON added in v1.0.0

func (v Vary) MarshalJSON() ([]byte, error)

func (Vary) String added in v1.0.0

func (v Vary) String() string

func (*Vary) UnmarshalJSON added in v1.0.0

func (v *Vary) UnmarshalJSON(data []byte) error

type Widget

type Widget interface {
	Run(chan<- []I3BarBlock) error
	Event(I3BarClickEvent, []I3BarBlock) error
	Stop() error
	Continue() error
	Shutdown() error
}

Widget represents a widget struct.

func NewWidget

func NewWidget(widgetConfig WidgetConfig, wlogger logger.Logger) (Widget, error)

NewWidget creates new widget by name.

type WidgetConfig added in v1.0.0

type WidgetConfig struct {
	Name       string              `yaml:"widget"`
	Workspaces []string            `yaml:"workspaces"`
	Templates  []I3BarBlock        `yaml:"-"`
	Events     []WidgetEventConfig `yaml:"events"`
	WorkDir    string              `yaml:"-"`
	Index      int                 `yaml:"-"`
	File       string              `yaml:"-"`
	Variables  map[string]string   `yaml:"variables"`

	Params map[string]interface{} `yaml:",inline"`

	IncludeStack []string `yaml:"-"`
}

WidgetConfig represents a widget configuration.

func ErrorWidget added in v1.0.0

func ErrorWidget(text string) WidgetConfig

ErrorWidget creates new widget with error message.

func (WidgetConfig) Validate added in v1.0.0

func (c WidgetConfig) Validate() error

Validate checks widget configuration.

type WidgetEventConfig added in v1.0.0

type WidgetEventConfig struct {
	Command      string   `yaml:"command"`
	Button       uint8    `yaml:"button"`
	Modifiers    []string `yaml:"modifiers,omitempty"`
	Name         string   `yaml:"name,omitempty"`
	Instance     string   `yaml:"instance,omitempty"`
	OutputFormat string   `yaml:"output_format,omitempty"`
	Override     bool     `yaml:"override"`
	WorkDir      string   `yaml:"workdir"`
}

WidgetEventConfig represents a widget events.

func (*WidgetEventConfig) Validate added in v1.0.0

func (e *WidgetEventConfig) Validate() error

Validate checks event parameters.

Jump to

Keyboard shortcuts

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