Skip to content

psqlmaster/clipboard-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„β†’πŸ“‹β†’πŸ“„ clipboard-tools for terminal

A set of command-line utilities for reliable file handling through the system clipboard in Linux.

Key Feature: automatic filename preservation when copying and restoring it when pasting - no manual specification required!

Package Contents

Utility Purpose
cf Copy File - copy file to clipboard
pf Paste File - paste from clipboard to file with original name

Features

  • βœ… Automatic detection of binary files (images, PDFs, archives)
  • βœ… Binary data encoding in base64 for reliable transfer
  • βœ… Original filename preservation in metadata
  • βœ… Tab-completion for filenames in Zsh
  • βœ… Protection against accidental file overwrites
  • βœ… Support for outputting clipboard content to terminal (pf -)

Quick Start

# 1. Installation
git clone https://github.com/psqlmaster/clipboard-tools.git && \
cd clipboard-tools && \
chmod +x ./install.sh && \
sudo ./install.sh

2. Usage

cf document.pdf          # Copy file to clipboard
pf                       # Paste as document.pdf
pf report.txt            # Paste under different name
pf - | grep "error"      # Output clipboard content to terminal

Usage Examples

Copy and paste with filename preservation

cf ~/Downloads/screenshot.png
# βœ“ Binary file 'screenshot.png' encoded and copied

pf
# βœ“ Binary data saved to 'screenshot.png'

Working with text files

cf ~/.ssh/id_rsa.pub
pf public_key.txt
# βœ“ Text saved to 'public_key.txt'

Force overwrite

pf -f existing_file.pdf

Viewing clipboard content

pf - | head -20

Requirements

Component Purpose Installation (Debian/Ubuntu)
xclip Clipboard operations sudo apt install xclip
base64 Binary data encoding included in coreutils
file File type detection pre-installed

πŸ”§ Project Structure

clipboard-tools/
β”œβ”€β”€ bin/                          # executable wrappers
β”œβ”€β”€ lib/                          # main logic
β”œβ”€β”€ share/zsh/vendor-completions/ # Zsh completions
β”œβ”€β”€ install.sh                    # installer
β”œβ”€β”€ README.md                     # documentation
└── LICENSE                       # license

Installation and Removal

# Installation (requires sudo)
sudo ./install.sh

# Check dependencies without installation
./install.sh --check

# Removal
sudo ./install.sh --uninstall

Tips

  • Zsh completions: After installation, run once:
autoload -Uz compinit && compinit
  • Metadata: Information about the last copied file is stored in ~/.cache/clipboard-meta

  • Safety: Binary files are always encoded in base64 - no risk of data corruption

License

BSD 3-Clause License - see license file


Designed for professionals who value efficiency and reliability in daily terminal work.

About

πŸ“„β†’πŸ“‹β†’πŸ“„ `clipboard-tools` for terminal: A set of command-line utilities for reliable file handling through the system clipboard in Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages