From 9641dc48e71b928a820629bebf9785a6fa8243aa Mon Sep 17 00:00:00 2001 From: Luis Pabon Date: Sun, 29 Sep 2019 09:06:01 +0100 Subject: [PATCH] feat(selector): add support for wofi (#24) --- selector.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/selector.go b/selector.go index 032b9ff..bb6683c 100644 --- a/selector.go +++ b/selector.go @@ -38,6 +38,8 @@ func selector(data []string, max int, tool string) (string, error) { args = []string{"rofi", "-dmenu", "-lines", strconv.Itoa(max)} + case "wofi": + args = []string{"wofi", "--show", "dmenu", strconv.Itoa(max)} default: return "", fmt.Errorf("Unsupported tool: %s", tool) } @@ -53,7 +55,13 @@ func selector(data []string, max int, tool string) (string, error) { } return "", err } - selected := string(b[:len(b)-1]) // drop newline added by dmenu/rofi + + // Wofi however does not error when no selection is done + if len(b) == 0 { + return "", nil + } + + selected := string(b[:len(b)-1]) // drop newline added by dmenu/rofi/wofi sel, ok := guide[selected] if !ok {