Documentation
¶
Index ¶
- Variables
- type Static
- type Transition
- type Wallpaper
- func (stw *Wallpaper) AddStatic(at time.Time, filename string)
- func (stw *Wallpaper) AddTransition(from, upto time.Time, fromFilename, toFilename, transitionType string)
- func (stw *Wallpaper) EventLoop(verbose bool, setWallpaperFunc func(string) error) error
- func (stw *Wallpaper) NextEvent(now time.Time) (interface{}, error)
- func (stw *Wallpaper) PrevEvent(now time.Time) (interface{}, error)
- func (stw *Wallpaper) SetInitialWallpaper(verbose bool, setWallpaperFunc func(string) error) error
- func (stw *Wallpaper) String() string
- func (stw *Wallpaper) UntilNext(et time.Time) time.Duration
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLoopTime = 5 * time.Second
Functions ¶
This section is empty.
Types ¶
type Transition ¶
type Transition struct {
From time.Time
UpTo time.Time
FromFilename string
ToFilename string
Type string
}
func (*Transition) Duration ¶
func (t *Transition) Duration() time.Duration
func (*Transition) String ¶
func (t *Transition) String(format string) string
type Wallpaper ¶
type Wallpaper struct {
STWVersion string
Name string
Format string
Path string // not part of the file data, but handy when parsing
Statics []*Static
Transitions []*Transition
LoopWait time.Duration // how long the main event loop should sleep
}
func DataToSimple ¶
DataToSimple converts from the contents of a Simple Timed Wallpaper file to a Wallpaper structs. The given path is used in the error messages and for setting stw.Path.
func NewWallpaper ¶
func ParseSTW ¶
Example ¶
stw, err := ParseSTW("testdata/adwaita-timed2.stw")
if err != nil {
panic(err)
}
fmt.Println(stw.Name)
Output: adwaita-timed
func (*Wallpaper) AddTransition ¶
func (*Wallpaper) NextEvent ¶
NextEvent finds the next event, given a timestamp. Returns an interface{} that is either a static or transition event.
func (*Wallpaper) PrevEvent ¶
PrevEvent finds the previous event, given a timestamp. Returns an interface{} that is either a static or transition event.
func (*Wallpaper) SetInitialWallpaper ¶
SetInitialWallpaper will set the first wallpaper, before starting the event loop
Click to show internal directories.
Click to hide internal directories.