Skip to content

lonerOrz/pantry

Repository files navigation

pantry - Generic Selector

A generic selector tool for handling various types of entries with text and image preview modes.

Preview

Description

pantry is a GTK4-based graphical interface tool for managing and selecting various types of entries such as bookmarks, commands, and images. It reads data from TOML configuration files and provides search and filtering capabilities, supporting both text and image preview modes.

Features

  • Support for text and image preview modes
  • Search and filtering functionality
  • Responsive user interface
  • Image preview and detailed information display
  • Configuration file-driven data management
  • Output piping for integration with other tools
  • Dynamic source mode for real-time command execution

Installation

1. Build from source

git clone https://github.com/lonerOrz/pantry.git
cd pantry
cargo build --release

2. Install via Nix (for Nix or NixOS users)

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    pantry.url = "github:lonerOrz/pantry";
  };

  outputs =
    inputs @{
      self,
      flake-utils,
      nixpkgs,
      ...
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = import nixpkgs {
          inherit system;
        };
      in
      {
        devShells.default = pkgs.mkShell {
          packages = [ inputs.pantry.packages.${system}.pantry ];
        };
      }
    );
}

Usage

Basic usage:

pantry -f /path/to/config.toml

Specify category:

pantry -f /path/to/config.toml -c bookmarks

Options:

  • -f, --config: Configuration file path [default: ~/.config/pantry/config.toml]
  • -c, --category: Specify the category to load (load only categories matching the global display mode if not specified)
  • -d, --display: Display mode: text or picture (overrides config file setting)
  • -m, --multi: Enable multi-selection mode (Tab to mark, Enter to confirm)

Keyboard Shortcuts

Key Action
/ Navigate list
Ctrl+p / Ctrl+n Navigate list (Emacs)
Ctrl+k / Ctrl+j Navigate list (Vim)
Enter Confirm selection
Escape Clear search, or close if empty
Ctrl+u Clear search input
Ctrl+c / Ctrl+g Quit
Tab Mark/unmark item (multi-select mode only, auto-advances down)
Shift+Tab Mark/unmark item (multi-select mode only, moves up)

Examples

Use with piped input:

echo -e "Option 1\nOption 2\nOption 3" | pantry

Multi-select mode — mark multiple items with Tab, confirm with Enter (newline-separated output):

pantry -f bookmarks.toml -m | xargs -n 1 xdg-open

Force picture mode (use with image paths):

pantry -f pictures.toml -d picture

Force text mode (use with URLs or text):

pantry -f bookmarks.toml -d text

Use dynamic source mode for real-time command integration:

# config.toml
[cliphist]
display = "picture"
source = "dynamic"

[cliphist.entries]
"cliphist list | head -n 10" = "cliphist decode {}"

Then run:

pantry -f config.toml -c cliphist

In dynamic mode, the left side of entries specifies a command whose output populates the list, and the right side specifies a command template where {} gets replaced with the selected item's value.

Documentation

For detailed usage instructions and examples, see our Getting Started Guide.

Configuration

pantry uses TOML format configuration files with separate display and input modes. Each category can optionally specify its own modes, which will override the global defaults.

For detailed configuration examples, see our Getting Started Guide and example files in the examples directory.

License

BSD 3-Clause License


If you find pantry useful, please give it a ⭐ and share! 🎉

About

A generic selector tool for handling various types of entries with text and image preview modes.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors