feat(selector): add support for wofi (#24)
This commit is contained in:
parent
913fb79ce8
commit
9641dc48e7
1 changed files with 9 additions and 1 deletions
10
selector.go
10
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 {
|
||||
|
|
Loading…
Reference in a new issue