widget

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HSLHueMax        = 360
	HSLSaturationMax = 100
	HSLLightnessMax  = 100
)

Variables

View Source
var DurationPattern = regexp.MustCompile(`^(\d+)(s|m|h|d)$`)
View Source
var EnvFieldPattern = regexp.MustCompile(`^\${([A-Z_]+)}$`)
View Source
var HSLColorPattern = regexp.MustCompile(`^(?:hsla?\()?(\d{1,3})(?: |,)+(\d{1,3})%?(?: |,)+(\d{1,3})%?\)?$`)

Functions

This section is empty.

Types

type Bookmarks

type Bookmarks struct {
	Groups []struct {
		Title string         `yaml:"title"`
		Color *HSLColorField `yaml:"color"`
		Links []struct {
			Title        string `yaml:"title"`
			URL          string `yaml:"url"`
			Icon         string `yaml:"icon"`
			IsSimpleIcon bool   `yaml:"-"`
			SameTab      bool   `yaml:"same-tab"`
			HideArrow    bool   `yaml:"hide-arrow"`
		} `yaml:"links"`
	} `yaml:"groups"`
	Style string `yaml:"style"`
	// contains filtered or unexported fields
}

func (*Bookmarks) GetType

func (w *Bookmarks) GetType() string

func (*Bookmarks) Initialize

func (widget *Bookmarks) Initialize() error

func (*Bookmarks) Render

func (widget *Bookmarks) Render() template.HTML

func (*Bookmarks) RequiresUpdate

func (w *Bookmarks) RequiresUpdate(now *time.Time) bool

func (*Bookmarks) Update

func (w *Bookmarks) Update(ctx context.Context)

type Calendar

type Calendar struct {
	Calendar *feed.Calendar
	// contains filtered or unexported fields
}

func (*Calendar) GetType

func (w *Calendar) GetType() string

func (*Calendar) Initialize

func (widget *Calendar) Initialize() error

func (*Calendar) Render

func (widget *Calendar) Render() template.HTML

func (*Calendar) RequiresUpdate

func (w *Calendar) RequiresUpdate(now *time.Time) bool

func (*Calendar) Update

func (widget *Calendar) Update(ctx context.Context)

type DurationField

type DurationField time.Duration

func (*DurationField) UnmarshalYAML

func (d *DurationField) UnmarshalYAML(node *yaml.Node) error

type HSLColorField

type HSLColorField struct {
	Hue        uint16
	Saturation uint8
	Lightness  uint8
}

func (*HSLColorField) AsCSSValue

func (c *HSLColorField) AsCSSValue() template.CSS

func (*HSLColorField) String

func (c *HSLColorField) String() string

func (*HSLColorField) UnmarshalYAML

func (c *HSLColorField) UnmarshalYAML(node *yaml.Node) error

type HackerNews

type HackerNews struct {
	Posts               feed.ForumPosts `yaml:"-"`
	Limit               int             `yaml:"limit"`
	SortBy              string          `yaml:"sort-by"`
	ExtraSortBy         string          `yaml:"extra-sort-by"`
	CollapseAfter       int             `yaml:"collapse-after"`
	CommentsUrlTemplate string          `yaml:"comments-url-template"`
	ShowThumbnails      bool            `yaml:"-"`
	// contains filtered or unexported fields
}

func (*HackerNews) GetType

func (w *HackerNews) GetType() string

func (*HackerNews) Initialize

func (widget *HackerNews) Initialize() error

func (*HackerNews) Render

func (widget *HackerNews) Render() template.HTML

func (*HackerNews) RequiresUpdate

func (w *HackerNews) RequiresUpdate(now *time.Time) bool

func (*HackerNews) Update

func (widget *HackerNews) Update(ctx context.Context)

type IFrame

type IFrame struct {
	Source string `yaml:"source"`
	Height int    `yaml:"height"`
	// contains filtered or unexported fields
}

func (*IFrame) GetType

func (w *IFrame) GetType() string

func (*IFrame) Initialize

func (widget *IFrame) Initialize() error

func (*IFrame) Render

func (widget *IFrame) Render() template.HTML

func (*IFrame) RequiresUpdate

func (w *IFrame) RequiresUpdate(now *time.Time) bool

func (*IFrame) Update

func (w *IFrame) Update(ctx context.Context)

type Monitor

type Monitor struct {
	Sites []struct {
		Title       string            `yaml:"title"`
		Url         OptionalEnvString `yaml:"url"`
		IconUrl     string            `yaml:"icon"`
		SameTab     bool              `yaml:"same-tab"`
		Status      *feed.SiteStatus  `yaml:"-"`
		StatusText  string            `yaml:"-"`
		StatusStyle string            `yaml:"-"`
	} `yaml:"sites"`
	Style string `yaml:"style"`
	// contains filtered or unexported fields
}

func (*Monitor) GetType

func (w *Monitor) GetType() string

func (*Monitor) Initialize

func (widget *Monitor) Initialize() error

func (*Monitor) Render

func (widget *Monitor) Render() template.HTML

func (*Monitor) RequiresUpdate

func (w *Monitor) RequiresUpdate(now *time.Time) bool

func (*Monitor) Update

func (widget *Monitor) Update(ctx context.Context)

type OptionalEnvString

type OptionalEnvString string

func (*OptionalEnvString) UnmarshalYAML

func (f *OptionalEnvString) UnmarshalYAML(node *yaml.Node) error

type RSS

type RSS struct {
	FeedRequests    []feed.RSSFeedRequest `yaml:"feeds"`
	Style           string                `yaml:"style"`
	ThumbnailHeight float64               `yaml:"thumbnail-height"`
	CardHeight      float64               `yaml:"card-height"`
	Items           feed.RSSFeedItems     `yaml:"-"`
	Limit           int                   `yaml:"limit"`
	CollapseAfter   int                   `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*RSS) GetType

func (w *RSS) GetType() string

func (*RSS) Initialize

func (widget *RSS) Initialize() error

func (*RSS) Render

func (widget *RSS) Render() template.HTML

func (*RSS) RequiresUpdate

func (w *RSS) RequiresUpdate(now *time.Time) bool

func (*RSS) Update

func (widget *RSS) Update(ctx context.Context)

type Reddit

type Reddit struct {
	Posts               feed.ForumPosts `yaml:"-"`
	Subreddit           string          `yaml:"subreddit"`
	Style               string          `yaml:"style"`
	ShowThumbnails      bool            `yaml:"show-thumbnails"`
	SortBy              string          `yaml:"sort-by"`
	TopPeriod           string          `yaml:"top-period"`
	Search              string          `yaml:"search"`
	ExtraSortBy         string          `yaml:"extra-sort-by"`
	CommentsUrlTemplate string          `yaml:"comments-url-template"`
	Limit               int             `yaml:"limit"`
	CollapseAfter       int             `yaml:"collapse-after"`
	RequestUrlTemplate  string          `yaml:"request-url-template"`
	// contains filtered or unexported fields
}

func (*Reddit) GetType

func (w *Reddit) GetType() string

func (*Reddit) Initialize

func (widget *Reddit) Initialize() error

func (*Reddit) Render

func (widget *Reddit) Render() template.HTML

func (*Reddit) RequiresUpdate

func (w *Reddit) RequiresUpdate(now *time.Time) bool

func (*Reddit) Update

func (widget *Reddit) Update(ctx context.Context)

type Releases

type Releases struct {
	Releases      feed.AppReleases  `yaml:"-"`
	Repositories  []string          `yaml:"repositories"`
	Token         OptionalEnvString `yaml:"token"`
	Limit         int               `yaml:"limit"`
	CollapseAfter int               `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*Releases) GetType

func (w *Releases) GetType() string

func (*Releases) Initialize

func (widget *Releases) Initialize() error

func (*Releases) Render

func (widget *Releases) Render() template.HTML

func (*Releases) RequiresUpdate

func (w *Releases) RequiresUpdate(now *time.Time) bool

func (*Releases) Update

func (widget *Releases) Update(ctx context.Context)

type Repository added in v0.4.0

type Repository struct {
	RequestedRepository string            `yaml:"repository"`
	Token               OptionalEnvString `yaml:"token"`
	PullRequestsLimit   int               `yaml:"pull-requests-limit"`
	IssuesLimit         int               `yaml:"issues-limit"`
	RepositoryDetails   feed.RepositoryDetails
	// contains filtered or unexported fields
}

func (*Repository) GetType added in v0.4.0

func (w *Repository) GetType() string

func (*Repository) Initialize added in v0.4.0

func (widget *Repository) Initialize() error

func (*Repository) Render added in v0.4.0

func (widget *Repository) Render() template.HTML

func (*Repository) RequiresUpdate added in v0.4.0

func (w *Repository) RequiresUpdate(now *time.Time) bool

func (*Repository) Update added in v0.4.0

func (widget *Repository) Update(ctx context.Context)

type Stocks

type Stocks struct {
	Stocks feed.Stocks `yaml:"stocks"`
	Sort   string      `yaml:"sort-by"`
	Style  string      `yaml:"style"`
	// contains filtered or unexported fields
}

TODO: rename to Markets at some point

func (*Stocks) GetType

func (w *Stocks) GetType() string

func (*Stocks) Initialize

func (widget *Stocks) Initialize() error

func (*Stocks) Render

func (widget *Stocks) Render() template.HTML

func (*Stocks) RequiresUpdate

func (w *Stocks) RequiresUpdate(now *time.Time) bool

func (*Stocks) Update

func (widget *Stocks) Update(ctx context.Context)

type TwitchChannels

type TwitchChannels struct {
	ChannelsRequest []string             `yaml:"channels"`
	Channels        []feed.TwitchChannel `yaml:"-"`
	CollapseAfter   int                  `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*TwitchChannels) GetType

func (w *TwitchChannels) GetType() string

func (*TwitchChannels) Initialize

func (widget *TwitchChannels) Initialize() error

func (*TwitchChannels) Render

func (widget *TwitchChannels) Render() template.HTML

func (*TwitchChannels) RequiresUpdate

func (w *TwitchChannels) RequiresUpdate(now *time.Time) bool

func (*TwitchChannels) Update

func (widget *TwitchChannels) Update(ctx context.Context)

type TwitchGames

type TwitchGames struct {
	Categories    []feed.TwitchCategory `yaml:"-"`
	Exclude       []string              `yaml:"exclude"`
	Limit         int                   `yaml:"limit"`
	CollapseAfter int                   `yaml:"collapse-after"`
	// contains filtered or unexported fields
}

func (*TwitchGames) GetType

func (w *TwitchGames) GetType() string

func (*TwitchGames) Initialize

func (widget *TwitchGames) Initialize() error

func (*TwitchGames) Render

func (widget *TwitchGames) Render() template.HTML

func (*TwitchGames) RequiresUpdate

func (w *TwitchGames) RequiresUpdate(now *time.Time) bool

func (*TwitchGames) Update

func (widget *TwitchGames) Update(ctx context.Context)

type Videos

type Videos struct {
	Videos           feed.Videos `yaml:"-"`
	VideoUrlTemplate string      `yaml:"video-url-template"`
	Style            string      `yaml:"style"`
	Channels         []string    `yaml:"channels"`
	Limit            int         `yaml:"limit"`
	// contains filtered or unexported fields
}

func (*Videos) GetType

func (w *Videos) GetType() string

func (*Videos) Initialize

func (widget *Videos) Initialize() error

func (*Videos) Render

func (widget *Videos) Render() template.HTML

func (*Videos) RequiresUpdate

func (w *Videos) RequiresUpdate(now *time.Time) bool

func (*Videos) Update

func (widget *Videos) Update(ctx context.Context)

type Weather

type Weather struct {
	Location     string          `yaml:"location"`
	ShowAreaName bool            `yaml:"show-area-name"`
	HideLocation bool            `yaml:"hide-location"`
	Units        string          `yaml:"units"`
	Place        *feed.PlaceJson `yaml:"-"`
	Weather      *feed.Weather   `yaml:"-"`
	TimeLabels   [12]string      `yaml:"-"`
	// contains filtered or unexported fields
}

func (*Weather) GetType

func (w *Weather) GetType() string

func (*Weather) Initialize

func (widget *Weather) Initialize() error

func (*Weather) Render

func (widget *Weather) Render() template.HTML

func (*Weather) RequiresUpdate

func (w *Weather) RequiresUpdate(now *time.Time) bool

func (*Weather) Update

func (widget *Weather) Update(ctx context.Context)

type Widget

type Widget interface {
	Initialize() error
	RequiresUpdate(*time.Time) bool
	Update(context.Context)
	Render() template.HTML
	GetType() string
}

func New

func New(widgetType string) (Widget, error)

type Widgets

type Widgets []Widget

func (*Widgets) UnmarshalYAML

func (w *Widgets) UnmarshalYAML(node *yaml.Node) error

Jump to

Keyboard shortcuts

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