Skip to content

Commit 55a34f2

Browse files
committed
Merge branch 'get-by-index'
2 parents 82c238a + 9fa86f8 commit 55a34f2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

streamdeck.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ func (sd *StreamDeck) ButtonUpdateHandler(b Button) {
8686
sd.updateButton(b)
8787
}
8888

89+
// GetButtonByIndex returns a button for the given index
90+
func (sd *StreamDeck) GetButtonIndex(btnIndex int) Button {
91+
b, ok := sd.buttons[btnIndex]
92+
if !ok {
93+
return nil
94+
}
95+
return b
96+
}
97+
8998
func (sd *StreamDeck) pressHandler(btnIndex int, d *Device, err error) {
9099
if err != nil {
91100
panic(err)

0 commit comments

Comments
 (0)