Skip to main content

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
  • pyperclip Python package
  • System clipboard utilities:
    • X11 (Xorg): xclip or xsel (usually pre-installed)
    • Wayland: wl-clipboard (must be installed manually)

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 (from wl-clipboard) is in your PATH
  • 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:

  1. Dependencies: Clearly lists both Python and system requirements
  2. Wayland Support: Explicitly mentions wl-clipboard installation
  3. Usage Examples: Shows both piped and interactive usage
  4. Troubleshooting: Includes common issues and solutions
  5. Security Note: Warns about sudo usage

You may want to adjust the installation commands based on the specific Linux distributions your users might have.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

echo_copy-0.1.1.tar.gz (1.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

echo_copy-0.1.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

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

Hashes for echo_copy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 76adb800b5cb0616a61ffe4abb839fc4ce8f37ba87895ab576d18662c63218b1
MD5 c32cddd2a55e6a9a975dcc87dd76e8f2
BLAKE2b-256 c27df28fba37c3655ef2441451b88b05da17d5c017dad7b2ce42a43e538b231c

See more details on using hashes here.

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

Hashes for echo_copy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7da15fa7492a4e6f2659779e774d5fa5495f38ee0beba9f524e4c6b64f9fe395
MD5 10ea9d92a10a1e250304ac686274a1a9
BLAKE2b-256 0478981949aecbf97e01c72c0a908c40c2ad39d6e12f568f9605ff9695406af2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page