/pmenu

Sleek dmenu alternative written in Python and powered by curses.

Primary LanguagePythonGNU General Public License v2.0GPL-2.0

pmenu

Sleek dmenu alternative written in Python and powered by curses.



Comes in different flavors:

You are now looking at the pmenu command for the terminal.


Installation

The following commands will download the latest version of pmenu from this repository and install it in your /usr/bin/ directory:

git clone https://github.com/Julynx/pmenu
cd pmenu
sudo chmod +x pmenu
sudo cp pmenu /usr/bin/

Usage

Usage:
  pmenu  "line1\nline2\nline3..."
         "line1" "line2" "line3" ...

Bindings:
  up     Highlight previous option.
  down   Highlight next option.
  enter  Select highlighted option, will be written to "/tmp/pmenu".
  esc    Quit menu and exit with code 1.

pmenu_fm: A practical use case

The pmenu_fm script included in this repository is an example of how pmenu can be integrated into a bash script to implement a simple file selector.

It uses lsd, a modern ls replacement, to get the list of files in the current directory and their associated icons. The list is then passed to pmenu, which displays a menu in the terminal window.

You can highlight a directory with the Up and Down keys, and change to the selected directory or xdg-open the selected file with the Enter key. The menu can be closed with the Esc key.