### Install Cliphist using Go Source: https://github.com/sentriz/cliphist/blob/master/readme.md Installs the cliphist utility from source using the Go programming language toolchain. This method requires Go to be installed on the system. ```go go install go.senan.xyz/cliphist@latest ``` -------------------------------- ### Install Cliphist from Source or Binary Source: https://context7.com/sentriz/cliphist/llms.txt Instructions for installing the Cliphist utility on a Linux system. Users can either compile from source using Go or download a pre-built static binary. ```bash go install go.senan.xyz/cliphist@latest curl -L https://github.com/sentriz/cliphist/releases/latest/download/cliphist-linux-amd64 -o cliphist chmod +x cliphist sudo mv cliphist /usr/local/bin/ ``` -------------------------------- ### Set up Cliphist as a Systemd User Service Source: https://context7.com/sentriz/cliphist/llms.txt Provides instructions on how to configure and run cliphist as a systemd user service, ensuring it starts automatically on user login. ```bash # Example systemd user service file content: # [Unit] # Description=Cliphist clipboard manager # # [Service] # ExecStart=/usr/bin/cliphist store # Restart=on-failure # # [Install] # WantedBy=default.target # To enable and start the service: # systemctl --user enable cliphist.service # systemctl --user start cliphist.service ``` -------------------------------- ### Integrate Cliphist with Wofi for Wayland Clipboard Selection Source: https://context7.com/sentriz/cliphist/llms.txt Shows Wofi integration for Wayland-native clipboard selection, including Sway configuration examples and using a script for image support. ```bash # Basic wofi selection cliphist list | wofi -S dmenu | cliphist decode | wl-copy ``` ```bash # Sway config example exec wl-paste --watch cliphist store bindsym Mod1+p exec cliphist list | wofi -S dmenu | cliphist decode | wl-copy ``` ```bash # Wofi with image support (using cliphist-wofi-img script) # Requires: gawk, imagemagick (magick), ripgrep (rg) ./cliphist-wofi-img | wl-copy ``` -------------------------------- ### Show Cliphist Version and Configuration Source: https://context7.com/sentriz/cliphist/llms.txt Displays the current version of cliphist and its active configuration settings. This is useful for verifying installation and understanding current operational parameters. ```bash cliphist version ``` -------------------------------- ### CLI Command Reference Source: https://context7.com/sentriz/cliphist/llms.txt Comprehensive guide to the Cliphist command-line interface for managing clipboard history. ```APIDOC ## store ### Description Reads clipboard content from stdin and saves it to the history database. Handles deduplication and size limits. ### Method CLI Command ### Parameters - **stdin** (stream) - Required - The clipboard content to store. ### Request Example wl-paste --watch cliphist store --- ## list ### Description Outputs all stored clipboard entries with their IDs and truncated previews. ### Method CLI Command ### Parameters - **-preview-width** (int) - Optional - Width of the preview text. ### Response - **Output** (string) - Tab-separated list of "\t" --- ## decode ### Description Retrieves the full original clipboard content for a given entry ID or stdin input. ### Method CLI Command ### Parameters - **id** (int) - Optional - The ID of the entry to decode. ### Request Example cliphist decode 42 --- ## delete ### Description Removes specific clipboard entries by reading lines with IDs from stdin. ### Method CLI Command ### Parameters - **stdin** (stream) - Required - Lines containing IDs to be deleted. --- ## delete-query ### Description Removes all entries whose content contains the specified search string. ### Method CLI Command ### Parameters - **query** (string) - Required - The search string to match against entries. --- ## wipe ### Description Removes all entries from the database and compacts it. ### Method CLI Command --- ## compact ### Description Optimizes the database file by removing unused space to reduce disk usage. ### Method CLI Command ``` -------------------------------- ### Select Clipboard Item using wofi Source: https://github.com/sentriz/cliphist/blob/master/readme.md Selects a clipboard history item using 'wofi' in dmenu mode. It lists history, filters with wofi, decodes the selection, and copies it to the clipboard. Includes an example Sway configuration. ```shell cliphist list | wofi -S dmenu | cliphist decode | wl-copy ``` ```shell exec wl-paste --watch cliphist store bindsym Mod1+p exec cliphist list | wofi -S dmenu | cliphist decode | wl-copy ``` -------------------------------- ### Listen for Clipboard Changes with wl-paste Source: https://github.com/sentriz/cliphist/blob/master/readme.md Uses wl-paste to watch for changes on the Wayland clipboard and pipes them to the 'cliphist store' command. This command should be run once per session, for example, in your Sway configuration. ```shell wl-paste --watch cliphist store ``` -------------------------------- ### Integrate Cliphist with dmenu for Clipboard Selection Source: https://context7.com/sentriz/cliphist/llms.txt Provides examples of integrating cliphist with dmenu for selecting and copying clipboard history. This workflow allows users to quickly find and paste previous clipboard entries. ```bash # Simple selection workflow cliphist list | dmenu | cliphist decode | wl-copy ``` ```bash # With prompt customization cliphist list | dmenu -p "Clipboard:" | cliphist decode | wl-copy ``` ```bash # Sway keybinding example (~/.config/sway/config) bindsym Mod1+v exec cliphist list | dmenu | cliphist decode | wl-copy ``` -------------------------------- ### Configure Cliphist via CLI Flags, Environment Variables, and Config File Source: https://context7.com/sentriz/cliphist/llms.txt Demonstrates various methods to configure cliphist settings such as max items, deduplication search depth, and preview width. Configuration can be done directly via command-line flags, by setting environment variables, or by creating a configuration file. ```bash # CLI flag configuration cliphist -max-items 1000 -max-dedupe-search 200 -preview-width 80 list ``` ```bash # Environment variable configuration export CLIPHIST_MAX_ITEMS=1000 export CLIPHIST_MAX_DEDUPE_SEARCH=200 export CLIPHIST_PREVIEW_WIDTH=80 export CLIPHIST_DB_PATH="/custom/path/to/db" export CLIPHIST_MIN_STORE_LENGTH=5 export CLIPHIST_MAX_STORE_SIZE="10MB" ``` ```bash # Config file (~/.config/cliphist/config) cat > ~/.config/cliphist/config << 'EOF' # Maximum number of items to store max-items 1000 # Maximum number of recent items to check for duplicates max-dedupe-search 200 # Maximum preview width in characters preview-width 80 # Minimum length (in characters) to store min-store-length 3 # Maximum size of clipboard content to store max-store-size 10MB # Custom database path (optional) # db-path /custom/path/to/db EOF ``` ```bash # Use custom config path cliphist -config-path /path/to/custom/config list ``` -------------------------------- ### Integrate Cliphist with fzf for Clipboard Selection and Preview Source: https://context7.com/sentriz/cliphist/llms.txt Demonstrates fzf integration with cliphist, enabling selection with preview functionality for non-binary clipboard items and multi-select for deletion. ```bash # Basic fzf selection cliphist list | fzf --no-sort | cliphist decode | wl-copy ``` ```bash # Hide ID column cliphist list | fzf -d $' ' --with-nth 2 --no-sort | cliphist decode | wl-copy ``` ```bash # With unique entries and preview (cliphist-fzf script) cliphist list | sort -k 2 -u | sort -nr | fzf --preview 'echo {} | cliphist decode' | cliphist decode | wl-copy ``` ```bash # Multi-select for deletion cliphist list | fzf --multi --no-sort | cliphist delete ``` -------------------------------- ### List and Select Clipboard Entries Source: https://context7.com/sentriz/cliphist/llms.txt Commands to display the clipboard history and integrate with external picker tools. The output format is tab-separated for easy parsing. ```bash cliphist list cliphist -preview-width 50 list cliphist list | dmenu cliphist list | rofi -dmenu cliphist list | fzf -d $'\t' --with-nth 2 | cliphist decode | wl-copy ``` -------------------------------- ### Select Clipboard Item using rofi (dmenu mode) Source: https://github.com/sentriz/cliphist/blob/master/readme.md Selects a clipboard history item using 'rofi' in dmenu mode. It lists history, filters with rofi, decodes the selection, and copies it to the clipboard. ```shell cliphist list | rofi -dmenu | cliphist decode | wl-copy ``` -------------------------------- ### Integrate Cliphist with Rofi for Clipboard Selection Source: https://context7.com/sentriz/cliphist/llms.txt Shows how to integrate cliphist with Rofi, supporting both dmenu mode and custom script mode for enhanced clipboard history selection, including image previews. ```bash # Rofi dmenu mode cliphist list | rofi -dmenu | cliphist decode | wl-copy ``` ```bash # Hide the ID column cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy ``` ```bash # Rofi custom mode (requires cliphist-rofi script in PATH) rofi -modi clipboard:/path/to/cliphist-rofi -show clipboard ``` ```bash # Rofi custom mode with image thumbnails rofi -modi clipboard:/path/to/cliphist-rofi-img -show clipboard -show-icons ``` ```bash # cliphist-rofi script content: cat > ~/.local/bin/cliphist-rofi << 'EOF' #!/usr/bin/env bash if [ -z "$1" ]; then cliphist list else cliphist decode <<<"$1" | wl-copy fi EOF chmod +x ~/.local/bin/cliphist-rofi ``` -------------------------------- ### Handle Tab Separator in wofi (with limitations) Source: https://github.com/sentriz/cliphist/blob/master/readme.md Attempts to configure wofi to display only the second column of 'cliphist list' output. However, this method has limitations with quotes in selections and is not recommended. ```shell cliphist list | wofi --dmenu --pre-display-cmd "echo '%s' | cut -f 2" | cliphist decode | wl-copy ``` -------------------------------- ### Select Clipboard Item using fuzzel (dmenu mode) Source: https://github.com/sentriz/cliphist/blob/master/readme.md Selects a clipboard history item using 'fuzzel' in dmenu mode. It lists history, filters with fuzzel, decodes the selection, and copies it to the clipboard. ```shell cliphist list | fuzzel --dmenu | cliphist decode | wl-copy ``` -------------------------------- ### Select Old Clipboard Item using dmenu Source: https://github.com/sentriz/cliphist/blob/master/readme.md Retrieves the clipboard history using 'cliphist list', pipes it to 'dmenu' for selection, decodes the selected item with 'cliphist decode', and copies it to the clipboard using 'wl-copy'. This command is typically bound to a keyboard shortcut. ```shell cliphist list | dmenu | cliphist decode | wl-copy ``` -------------------------------- ### Select Clipboard Item using fzf Source: https://github.com/sentriz/cliphist/blob/master/readme.md Selects a clipboard history item using 'fzf' as the picker. It lists history, filters with fzf, decodes the selection, and copies it to the clipboard. ```shell cliphist list | fzf --no-sort | cliphist decode | wl-copy ``` -------------------------------- ### Integrate Cliphist with Fuzzel for Clipboard Selection and Image Thumbnails Source: https://context7.com/sentriz/cliphist/llms.txt Details Fuzzel integration for clipboard selection, including support for image thumbnails and custom actions like clearing history or deleting selected items. ```bash # Basic fuzzel selection cliphist list | fuzzel --dmenu | cliphist decode | wl-copy ``` ```bash # Hide ID column cliphist list | fuzzel --dmenu --with-nth 2 | cliphist decode | wl-copy ``` ```bash # With image thumbnails (cliphist-fuzzel-img script) # Features: ALT+0 to clear history, ALT+1 to delete selected item ./cliphist-fuzzel-img ``` -------------------------------- ### Store Clipboard Content Source: https://context7.com/sentriz/cliphist/llms.txt Commands to capture clipboard data into the history database. It supports automatic monitoring via wl-paste and manual input piping. ```bash wl-paste --watch cliphist store echo "Hello, World!" | cliphist store wl-paste --type text --watch cliphist store wl-paste --type image --watch cliphist store ``` -------------------------------- ### Handle Tab Separator in rofi Source: https://github.com/sentriz/cliphist/blob/master/readme.md Configures rofi to display only the second column (the preview) when using 'cliphist list'. This ensures that the selection process ignores the leading ID number, providing a cleaner user experience. ```shell cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy ``` -------------------------------- ### Compact Clipboard History Database Source: https://github.com/sentriz/cliphist/blob/master/readme.md Optimizes the clipboard history database by removing redundant entries or reorganizing data. This can help in managing disk space and improving performance. ```shell cliphist compact ``` -------------------------------- ### Delete Old Clipboard Item using dmenu Source: https://github.com/sentriz/cliphist/blob/master/readme.md Lists clipboard history, allows selection via 'dmenu', and deletes the selected item using 'cliphist delete'. An alternative manual query method is also provided. ```shell cliphist list | dmenu | cliphist delete ``` ```shell cliphist delete-query "secret item" ``` -------------------------------- ### Store Specific MIME Types with wl-paste Source: https://github.com/sentriz/cliphist/blob/master/readme.md Configures wl-paste to watch for specific MIME types (text and image) and store them separately in the cliphist history. This allows for more granular control over what data is saved. ```shell wl-paste --type text --watch cliphist store ``` ```shell wl-paste --type image --watch cliphist store ``` -------------------------------- ### Decode and Retrieve Clipboard Data Source: https://context7.com/sentriz/cliphist/llms.txt Commands to retrieve the full original content of a clipboard entry. This is typically used after selecting an item from a list. ```bash cliphist list | dmenu | cliphist decode | wl-copy cliphist decode 42 cliphist list | grep "binary data" | head -1 | cliphist decode > /tmp/clipboard_image.png ``` -------------------------------- ### Delete and Manage History Entries Source: https://context7.com/sentriz/cliphist/llms.txt Commands to remove specific entries or clear the entire database. Supports interactive deletion and pattern-based removal. ```bash cliphist list | dmenu | cliphist delete cliphist delete-query "secret" cliphist wipe cliphist compact ``` -------------------------------- ### Handle Sensitive Clipboard Data with CLIPBOARD_STATE Source: https://context7.com/sentriz/cliphist/llms.txt Explains how cliphist interacts with the `CLIPBOARD_STATE` environment variable for managing sensitive data. Setting it to 'sensitive' prevents storage, while 'clear' removes the last entry. ```bash # When CLIPBOARD_STATE=sensitive, cliphist ignores the clipboard content # When CLIPBOARD_STATE=clear, cliphist deletes the last stored item # Password managers typically set this automatically # Manual test: CLIPBOARD_STATE=sensitive wl-copy "secret password" # The password will NOT be stored in cliphist # Clearing sensitive data CLIPBOARD_STATE=clear cliphist store # Removes the last entry from history ``` -------------------------------- ### Handle Tab Separator in fuzzel Source: https://github.com/sentriz/cliphist/blob/master/readme.md Configures fuzzel to use only the second column of the 'cliphist list' output for selection. This is achieved using the '--with-nth 2' option, ensuring that the leading ID number is not part of the selectable item. ```shell cliphist list | fuzzel --dmenu --with-nth 2 | cliphist decode | wl-copy ``` -------------------------------- ### Handle Tab Separator in fzf Source: https://github.com/sentriz/cliphist/blob/master/readme.md Configures fzf to correctly handle tab-separated output from 'cliphist list', ensuring only the preview column is used for selection. This prevents issues with leading numbers in the displayed history. ```shell cliphist list | fzf -d $' ' --with-nth 2 | cliphist decode | wl-copy ``` -------------------------------- ### Clear Clipboard History Database Source: https://github.com/sentriz/cliphist/blob/master/readme.md Wipes the entire clipboard history database managed by cliphist. This action is irreversible. ```shell cliphist wipe ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.