diff --git a/deck.go b/deck.go index bc91c48..3c74693 100644 --- a/deck.go +++ b/deck.go @@ -235,7 +235,7 @@ func (d *Deck) triggerAction(dev *streamdeck.Device, index uint8, hold bool) { go executeCommand(a.Exec) } } else { - w.TriggerAction() + w.TriggerAction(hold) } } } diff --git a/widget.go b/widget.go index f817f2a..c12d717 100644 --- a/widget.go +++ b/widget.go @@ -22,7 +22,7 @@ type Widget interface { Update(dev *streamdeck.Device) error Action() *ActionConfig ActionHold() *ActionConfig - TriggerAction() + TriggerAction(hold bool) } // BaseWidget provides common functionality required by all widgets. @@ -52,7 +52,7 @@ func (w *BaseWidget) ActionHold() *ActionConfig { } // TriggerAction gets called when a button is pressed. -func (w *BaseWidget) TriggerAction() { +func (w *BaseWidget) TriggerAction(_ bool) { // just a stub } diff --git a/widget_recent_window.go b/widget_recent_window.go index 957a24b..6250059 100644 --- a/widget_recent_window.go +++ b/widget_recent_window.go @@ -58,13 +58,18 @@ func (w *RecentWindowWidget) Update(dev *streamdeck.Device) error { } // TriggerAction gets called when a button is pressed. -func (w *RecentWindowWidget) TriggerAction() { +func (w *RecentWindowWidget) TriggerAction(hold bool) { if xorg == nil { log.Println("xorg support is disabled!") return } if int(w.window) < len(recentWindows) { + if hold { + _ = xorg.CloseWindow(recentWindows[w.window]) + return + } + _ = xorg.RequestActivation(recentWindows[w.window]) } }