swaysw: don't return error when no window is selected in wofi
This commit is contained in:
parent
de732b8317
commit
1e49032fbf
5
main.go
5
main.go
@ -44,7 +44,7 @@ func selectWithWofi(windows string) string {
|
|||||||
cmd.Stdin = strings.NewReader(windows)
|
cmd.Stdin = strings.NewReader(windows)
|
||||||
stdout, err := cmd.Output()
|
stdout, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return ""
|
||||||
}
|
}
|
||||||
return strings.TrimSpace(string(stdout))
|
return strings.TrimSpace(string(stdout))
|
||||||
}
|
}
|
||||||
@ -82,7 +82,8 @@ func main() {
|
|||||||
var windows []window
|
var windows []window
|
||||||
flatten(swaymsg_output, &windows)
|
flatten(swaymsg_output, &windows)
|
||||||
|
|
||||||
selected := selectWithWofi(getWindowNames(windows))
|
if selected := selectWithWofi(getWindowNames(windows)); selected != "" {
|
||||||
windowId := findWindowId(selected, windows)
|
windowId := findWindowId(selected, windows)
|
||||||
switchToWindow(windowId)
|
switchToWindow(windowId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user