A Lua wrapper for tofi, a dmenu/rofi replacement for Wayland.
luarocks install tofi-lualocal tofi = require("tofi")
-- Basic usage with options and choices
local menu = tofi
.options({
width = "33%",
height = "33%",
["outline-width"] = 4,
["prompt-text"] = "Choose:",
anchor = "center"
})
.choices({ "Choice A", "Choice B", "Choice C" })
-- Open the menu and get the result
local result = menu.open()
if result then
print("You selected: " .. result)
endReturns a new opener with the specified options.
opts: Table of tofi command line options (e.g.,{ width = "50%", anchor = "top" }).
Returns a new opener with the specified choices.
items: Array of strings to display.
Opens the tofi window. Returns the selected string, or nil/empty string if cancelled.
Returns a table containing current choices and options.