Skip to content

Commit 800932a

Browse files
zMoooooritzmuesli
authored andcommitted
Adapt README for recent changes and smalls fixes
1 parent 69571de commit 800932a

3 files changed

Lines changed: 35 additions & 8 deletions

File tree

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An application to control your Elgato Stream Deck on Linux
1818
- Buttons
1919
- Time (with formatting)
2020
- CPU/Mem usage
21+
- Command output
2122
- Recently used windows (X11-only)
2223
- Lets you trigger several actions:
2324
- Run commands
@@ -108,6 +109,18 @@ directory. Edit them to your needs!
108109

109110
### Widgets
110111

112+
Any widget is build up the following way:
113+
114+
```
115+
[[keys]]
116+
index = 0
117+
interval = 500
118+
```
119+
120+
`index` needs to be present in every widget and describes the position of the widget on the streamdeck.
121+
`index` is 0-indexed and counted from top to bottom and left to right.
122+
The attribute `interval` is optional and defines the time in `ms` between two consecutive updates of the widget.
123+
111124
#### Button
112125

113126
A simple button that can display an image and/or a label.
@@ -118,6 +131,7 @@ A simple button that can display an image and/or a label.
118131
[keys.widget.config]
119132
icon = "/some/image.png"
120133
label = "My Button"
134+
fontsize = 10.0
121135
```
122136

123137
#### Recent Window (requires X11)
@@ -129,7 +143,7 @@ activates the window.
129143
[keys.widget]
130144
id = "recentWindow"
131145
[keys.widget.config]
132-
window = "1"
146+
window = 1
133147
```
134148

135149
#### Time
@@ -177,6 +191,18 @@ This widget shows the current CPU or memory utilization as a bar graph.
177191

178192
There are two values for `mode`: `cpu` and `memory`.
179193

194+
#### Command
195+
196+
A widget that displays the output of commands.
197+
198+
```
199+
[keys.widget]
200+
id = "command"
201+
[keys.widget.config]
202+
command = "echo 'Files:'; ls -a ~ | wc -l"
203+
font = "regular;bold"
204+
```
205+
180206
### Background Image
181207

182208
You can configure each deck to display an individual wallpaper behind its

widget.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func NewWidget(base string, kc KeyConfig, bg image.Image) (Widget, error) {
113113
return NewTopWidget(*bw, kc.Widget), nil
114114

115115
case "command":
116-
return NewCommandWidget(*bw, kc.Widget)
116+
return NewCommandWidget(*bw, kc.Widget), nil
117117
}
118118

119119
// unknown widget ID

widget_command.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,29 @@ import (
99
"github.com/muesli/streamdeck"
1010
)
1111

12-
// CommandWidget is a widget displaying the output of command(s)
12+
// CommandWidget is a widget displaying the output of command(s).
1313
type CommandWidget struct {
1414
BaseWidget
1515
command string
1616
font string
1717
}
1818

19-
func NewCommandWidget(bw BaseWidget, opts WidgetConfig) (*CommandWidget, error) {
19+
// NewCommandWidget returns a new CommandWidget.
20+
func NewCommandWidget(bw BaseWidget, opts WidgetConfig) *CommandWidget {
2021
bw.setInterval(opts.Interval, 1000)
2122

2223
var command, font string
23-
ConfigValue(opts.Config["command"], &command)
24-
ConfigValue(opts.Config["font"], &font)
24+
_ = ConfigValue(opts.Config["command"], &command)
25+
_ = ConfigValue(opts.Config["font"], &font)
2526

2627
return &CommandWidget{
2728
BaseWidget: bw,
2829
command: command,
2930
font: font,
30-
}, nil
31+
}
3132
}
3233

33-
// Update renders the widget
34+
// Update renders the widget.
3435
func (w *CommandWidget) Update(dev *streamdeck.Device) error {
3536
size := int(dev.Pixels)
3637
margin := size / 18

0 commit comments

Comments
 (0)