Lua bindings for tofi.
local tofi = require("tofi")
local selection = tofi
.options({ width = "33%", height = "33%", anchor = "bottom" })
.choices({
{ name = "Apples", value = "apple" },
{ name = "Bananas", value = "banana" },
"Red",
"Yellow",
})
.open()
print(selection) -- "apple", "banana", "Red", "Yellow", or nil if cancelledrequire("tofi") returns an opener with these methods:
.options({...})— set tofi flags (e.g.["outline-width"] = 4,["prompt-text"] = "Choose:"). Returns a new opener..choices({...})— set menu entries. Entries can be strings or{name, value}tables. Returns a new opener..open()— launch tofi, return the selected value, ornilif cancelled..info()— return{choices = ..., options = ...}for debugging.
If no choices are given, tofi-drun is used instead.