LinuxCommandLibrary

cliphist

Manage clipboard history entries

TLDR

List clipboard history entries

$ cliphist list
copy

Select and copy a previous clipboard entry (using fzf)
$ cliphist list | fzf | cliphist decode | wl-copy
copy

Delete all stored clipboard entries
$ cliphist wipe
copy

Delete a specific clipboard entry by ID
$ cliphist delete [id]
copy

Save the current clipboard content manually
$ wl-paste | cliphist store
copy

SYNOPSIS

cliphist {list|store|encode|decode} [options]

PARAMETERS

list
    List history items with optional filter

store
    Store current clipboard to history

encode
    Encode stdin data to history files

decode
    Decode and output history item to stdout

-c, --category CATEGORY
    Category: text|image (default: text)

-f FILTER
    Regex filter for text items (list only)

-l LENGTH
    Truncate text/image preview to LENGTH chars (list/encode)

-n COUNT
    Limit output to COUNT newest items (list only)

-t
    Prepend MIME type to each list item

-f FORMAT
    Image output format: png|jpg (encode only)

-h, --help
    Display help

-v, --version
    Print version info

DESCRIPTION

Cliphist is a lightweight CLI tool for managing clipboard history on Wayland using wl-clipboard. It stores clipboard contents as files in ~/.local/share/cliphist/, categorized into text and image. Text is saved plainly or base64-encoded; images default to PNG.

Use cliphist store to save current clipboard, often via watchers like wl-paste --watch cliphist store. List history with cliphist list, filter by regex or length, then select via rofi, fzf, etc., and pipe to wl-copy via cliphist decode. Supports truncation, mimetype display, and image formats like JPG.

Perfect for Sway, Hyprland users needing scriptable history without daemons or GUIs. Minimal dependencies, written in Zig for efficiency.

CAVEATS

Wayland-only; requires wl-clipboard. No auto-cleanup: history grows, monitor disk in ~/.local/share/cliphist/. Images consume space as PNG/JPG.

USAGE EXAMPLES

List & select: cliphist list | rofi -dmenu | cliphist decode | wl-copy
Watch text: wl-paste -t text --watch cliphist store
Watch images: wl-paste -t image --watch cliphist store -c image

STORAGE

Files in ~/.local/share/cliphist/{text,image}/. Text: plain or base64; newest first. Use find or scripts for cleanup.

HISTORY

Developed by Omar (sentriz) in 2020 using Zig. Gained popularity in Wayland communities (Sway, Hyprland) as wl-clipboard companion. Actively maintained on GitHub with 2k+ stars.

SEE ALSO

wl-copy(1), wl-paste(1), grim(1)

Copied to clipboard