From 1e49032fbfec10b51c9f627aab286290ac15977c Mon Sep 17 00:00:00 2001 From: Asmir A Date: Fri, 27 Oct 2023 12:15:26 +0200 Subject: [PATCH] swaysw: don't return error when no window is selected in wofi --- main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 103f047..fcded60 100644 --- a/main.go +++ b/main.go @@ -44,7 +44,7 @@ func selectWithWofi(windows string) string { cmd.Stdin = strings.NewReader(windows) stdout, err := cmd.Output() if err != nil { - log.Fatal(err) + return "" } return strings.TrimSpace(string(stdout)) } @@ -82,7 +82,8 @@ func main() { var windows []window flatten(swaymsg_output, &windows) - selected := selectWithWofi(getWindowNames(windows)) - windowId := findWindowId(selected, windows) - switchToWindow(windowId) + if selected := selectWithWofi(getWindowNames(windows)); selected != "" { + windowId := findWindowId(selected, windows) + switchToWindow(windowId) + } }