Skip to content

Commit

Permalink
Update README and add weather widget to the main.deck
Browse files Browse the repository at this point in the history
  • Loading branch information
zMoooooritz authored and muesli committed Jun 10, 2021
1 parent 788e3f9 commit c3f9531
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,11 @@ A simple button that can display an image and/or a label.
label = "My Button" # optional
fontsize = 10.0 # optional
color = "#fefefe" # optional
flatten = true # optional
```

If `flatten = true` all pixels of the condition icon will have the color `color`.

#### Recent Window (requires X11)

Displays the icon of a recently used window/application. Pressing the button
Expand Down Expand Up @@ -224,6 +227,24 @@ A widget that displays the output of commands.
color = "#fefefe" # optional
```

#### Weather

A widget that displays the weather condition and teamperature.

```toml
[keys.widget]
id = "weather"
[keys.widget.config]
location = "MyCity" # optional
unit = "celsius" # optional
color = "#fefefe" # optional
flatten = true # optional
```

The supported location types can be found [here](http://wttr.in/:help).
The unit has to be either `celsius` or `fahrenheit`.
If `flatten = true` all pixels of the condition icon will have the color `color`.

### Background Image

You can configure each deck to display an individual wallpaper behind its
Expand Down
5 changes: 5 additions & 0 deletions decks/main.deck
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
[keys.widget.config]
mode = "memory"

[[keys]]
index = 2
[keys.widget]
id = "weather"

[[keys]]
index = 3
[keys.widget]
Expand Down
6 changes: 3 additions & 3 deletions widget_button.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ func NewButtonWidget(bw BaseWidget, opts WidgetConfig) (*ButtonWidget, error) {
if err != nil {
return nil, err
}
if w.flatten {
w.icon = flattenImage(w.icon, w.color)
}
}

return w, nil
Expand All @@ -69,6 +66,9 @@ func (w *ButtonWidget) Update(dev *streamdeck.Device) error {
height := size - (margin * 2)
img := image.NewRGBA(image.Rect(0, 0, size, size))

if w.icon != nil && w.flatten {
w.icon = flattenImage(w.icon, w.color)
}
if w.label != "" {
iconsize := int((float64(height) / 3.0) * 2.0)
bounds := img.Bounds()
Expand Down
2 changes: 1 addition & 1 deletion widget_weather.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (w *WeatherData) Fetch() {

// NewWeatherWidget returns a new WeatherWidget.
func NewWeatherWidget(bw BaseWidget, opts WidgetConfig) *WeatherWidget {
bw.setInterval(opts.Interval, 1000)
bw.setInterval(opts.Interval, 60000)

var location, unit string
_ = ConfigValue(opts.Config["location"], &location)
Expand Down

0 comments on commit c3f9531

Please sign in to comment.