Skip to content

Commit 3f3bcae

Browse files
committed
Allow other actions when handler set on knob/touch
1 parent be0872f commit 3f3bcae

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

streamdeckd/interface.go

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -301,41 +301,40 @@ func HandleKnobInput(dev *VirtualDev, knob *api.KnobV3, event streamdeck.InputEv
301301
EventType: api.InputEventType(event.EventType),
302302
RotateNotches: event.RotateNotches,
303303
})
304-
} else {
305-
var actions api.KnobActionV3
306-
if event.EventType == streamdeck.KNOB_PRESS {
307-
actions = knobConfig.KnobPressAction
308-
} else if event.EventType == streamdeck.KNOB_CCW {
309-
actions = knobConfig.KnobTurnDownAction
310-
} else if event.EventType == streamdeck.KNOB_CW {
311-
actions = knobConfig.KnobTurnUpAction
312-
}
313-
if actions.Command != "" {
314-
RunCommand(actions.Command)
315-
}
316-
if actions.Keybind != "" {
317-
err := ExecuteKeybind(actions.Keybind)
318-
if err != nil {
319-
log.Println("[ERROR] Failed to execute keybind:", err)
320-
}
321-
}
322-
if actions.SwitchPage != 0 {
323-
page := actions.SwitchPage - 1
324-
dev.SetPage(page)
325-
}
326-
if actions.Brightness != 0 {
327-
err := dev.SetBrightness(uint8(actions.Brightness))
328-
if err != nil {
329-
log.Println(err)
330-
}
331-
}
332-
if actions.Url != "" {
333-
RunCommand("xdg-open " + actions.Url)
304+
}
305+
var actions api.KnobActionV3
306+
if event.EventType == streamdeck.KNOB_PRESS {
307+
actions = knobConfig.KnobPressAction
308+
} else if event.EventType == streamdeck.KNOB_CCW {
309+
actions = knobConfig.KnobTurnDownAction
310+
} else if event.EventType == streamdeck.KNOB_CW {
311+
actions = knobConfig.KnobTurnUpAction
312+
}
313+
if actions.Command != "" {
314+
RunCommand(actions.Command)
315+
}
316+
if actions.Keybind != "" {
317+
err := ExecuteKeybind(actions.Keybind)
318+
if err != nil {
319+
log.Println("[ERROR] Failed to execute keybind:", err)
334320
}
335-
if actions.ObsCommand != "" {
336-
runObsCommand(actions.ObsCommand, actions.ObsCommandParams)
321+
}
322+
if actions.SwitchPage != 0 {
323+
page := actions.SwitchPage - 1
324+
dev.SetPage(page)
325+
}
326+
if actions.Brightness != 0 {
327+
err := dev.SetBrightness(uint8(actions.Brightness))
328+
if err != nil {
329+
log.Println(err)
337330
}
338331
}
332+
if actions.Url != "" {
333+
RunCommand("xdg-open " + actions.Url)
334+
}
335+
if actions.ObsCommand != "" {
336+
runObsCommand(actions.ObsCommand, actions.ObsCommandParams)
337+
}
339338
}
340339

341340
func ExecuteKeybind(keybind string) error {

0 commit comments

Comments
 (0)