p-gen/smenu logo

p-gen/smenu

Free

smenu started as a lightweight and flexible terminal menu generator, but quickly evolved into a powerful and versatile CLI selection tool for interactive or scripting use.

FreeFree tier
Inputs: text, file
Type
Open Source

About p-gen/smenu

smenu is a versatile CLI selection tool that functions as a selection filter, akin to how sed is an editing filter. It reads words from standard input or a file and displays them in a scrolling window with various layouts. Users can navigate the cursor using keyboard and mouse to select one or more words. Notably, smenu does not clear the terminal screen; it overlays the selection window at the cursor position without disturbing previous content. It supports UTF-8 encoding, including double-width characters and experimental extended grapheme clusters, with optimal performance on terminals like WezTerm or iTerm. smenu is designed for both interactive use and scripting, and works on any terminal managed by the terminfo database. The project is open source, hosted on GitHub under the p-gen/smenu repository.

Key Features

Reads words from standard input or a file
Displays items in various layouts within a scrolling window
Cursor navigation via keyboard and mouse
Supports UTF-8 encoding including double-width characters and extended grapheme clusters (experimental)
Works on all terminals managed by the terminfo database
Terminal screen not cleared at start or end; selection window overlays at cursor position
Suitable for both interactive use and scripting
Open source (C language) with build support for Unix-like systems

Pros & Cons

Pros
  • Lightweight and efficient for terminal use
  • No screen clearing preserves terminal history
  • Cross-platform: runs on any Unix-like system with terminfo
  • Supports modern terminal features like UTF-8 and mouse input
  • Flexible layouts and navigation options
Cons
  • Limited to text-based terminal environments
  • Extended grapheme cluster support is experimental and terminal-dependent
  • Requires terminfo development platform for building from source
  • Not suitable for graphical or web-based interfaces

Best For

Interactive selection from a list of options in the terminalFiltering and selecting items in shell scripts or pipelinesCreating terminal-based menus for command-line applicationsChoosing from dynamically generated word lists (e.g., search results, file names)

FAQ

How do I build smenu from source?
Use the provided build.sh script, which accepts the same arguments as the GNU configure script. Run build.sh --help to see options. The tool requires a functional terminfo development platform.
How do I install smenu after building?
Once built, run make install with appropriate privileges.
Should I open an issue or a discussion?
Open an issue for bugs or clearly described feature requests. Open a discussion for questions, help achieving something, ideas, showcasing cool uses, or anything else.