A simple Python script that reads from stdin and copies the input to the system clipboard
Project description
ec
A simple Python script that reads from stdin and copies the input to the system clipboard.
Features
- Reads input from stdin (piped input or manual typing)
- Preserves input in real-time while copying
- Handles keyboard interrupts gracefully
- Works with both X11 and Wayland systems
Requirements
- Python 3.x
pyperclipPython package- System clipboard utilities:
- X11 (Xorg):
xcliporxsel(usually pre-installed) - Wayland:
wl-clipboard(must be installed manually)
- X11 (Xorg):
Installation
1. Install Python Dependencies
pip install pyperclip ec
2. Install System Clipboard Utilities
For X11 (Xorg) Users
Most Linux distributions come with xclip or xsel pre-installed. If not:
# Debian/Ubuntu
sudo apt install xclip
# Arch Linux
sudo pacman -S xclip
# Fedora
sudo dnf install xclip
For Wayland Users
Install wl-clipboard (required for Wayland compatibility):
# Debian/Ubuntu
sudo apt install wl-clipboard
# Arch Linux
sudo pacman -S wl-clipboard
# Fedora
sudo dnf install wl-clipboard
Usage
Basic Usage
Pipe any command's output to the clipboard:
echo "Hello, clipboard!" | ec
# or
cat file.txt | ec
# or
ping google.com | ec
Notes
- On Wayland, ensure
wl-copy(fromwl-clipboard) is in yourPATH - If you encounter clipboard issues, try running with
sudo(not recommended for security) - The script preserves all whitespace and formatting from the input
Key Points Covered:
- Dependencies: Clearly lists both Python and system requirements
- Wayland Support: Explicitly mentions
wl-clipboardinstallation - Usage Examples: Shows both piped and interactive usage
- Troubleshooting: Includes common issues and solutions
- Security Note: Warns about
sudousage
You may want to adjust the installation commands based on the specific Linux distributions your users might have.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file echo_copy-0.1.1.tar.gz.
File metadata
- Download URL: echo_copy-0.1.1.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76adb800b5cb0616a61ffe4abb839fc4ce8f37ba87895ab576d18662c63218b1
|
|
| MD5 |
c32cddd2a55e6a9a975dcc87dd76e8f2
|
|
| BLAKE2b-256 |
c27df28fba37c3655ef2441451b88b05da17d5c017dad7b2ce42a43e538b231c
|
File details
Details for the file echo_copy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: echo_copy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7da15fa7492a4e6f2659779e774d5fa5495f38ee0beba9f524e4c6b64f9fe395
|
|
| MD5 |
10ea9d92a10a1e250304ac686274a1a9
|
|
| BLAKE2b-256 |
0478981949aecbf97e01c72c0a908c40c2ad39d6e12f568f9605ff9695406af2
|