feat(selector): add prompt to rofi/wofi

This commit is contained in:
yory8 2019-10-13 20:28:46 +02:00
parent 1a22fa442f
commit f5ed53d378
2 changed files with 5 additions and 5 deletions

View file

@ -65,7 +65,7 @@ func main() {
log.Fatal(err)
}
selection, err := selector(history, *maxPicker, *pickTool)
selection, err := selector(history, *maxPicker, *pickTool, "pick")
if err != nil {
log.Fatal(err)
}
@ -90,7 +90,7 @@ func main() {
return
}
selection, err := selector(history, *maxClearer, *clearTool)
selection, err := selector(history, *maxClearer, *clearTool, "clear")
if err != nil {
log.Fatal(err)
}

View file

@ -9,7 +9,7 @@ import (
"strings"
)
func selector(data []string, max int, tool string) (string, error) {
func selector(data []string, max int, tool string, prompt string) (string, error) {
if len(data) == 0 {
return "", errors.New("nothing to show: no data available")
}
@ -35,11 +35,11 @@ func selector(data []string, max int, tool string) (string, error) {
"-l",
strconv.Itoa(max)}
case "rofi":
args = []string{"rofi", "-dmenu",
args = []string{"rofi", "-p", prompt, "-dmenu",
"-lines",
strconv.Itoa(max)}
case "wofi":
args = []string{"wofi", "--cache-file", "/dev/null", "--dmenu"}
args = []string{"wofi", "-p", prompt, "--cache-file", "/dev/null", "--dmenu"}
default:
return "", fmt.Errorf("Unsupported tool: %s", tool)
}