Skip to content

Conversation

@ErvisTusha
Copy link

@ErvisTusha ErvisTusha commented Jan 7, 2026

Overview

This pull request improves clipboard functionality by enhancing error handling across all platforms, with particular focus on Linux systems. The changes ensure that clipboard operations properly propagate errors and provide meaningful feedback to users when issues occur.

Changes

1. Clipboard.ts (util/clipboard.ts)

  • Linux Wayland support: Added proper detection for Wayland environments via WAYLAND_DISPLAY environment variable
  • Exit code validation: Added checks for command exit codes (0 means success) for all clipboard tools:
    • wl-copy (Wayland)
    • xclip (X11)
    • xsel (X11)
  • Improved error handling: Tools now throw descriptive errors when clipboard operations fail, instead of silently failing
  • Better error messages: Specific error messages indicate which tool failed and what to install if tools are missing

2. App.tsx (ui/app.tsx)

  • Error propagation: Updated clipboard.copy() calls to properly handle errors
  • User feedback: Added error toast notifications when clipboard operations fail
  • Graceful degradation: Users are informed when copy operation fails instead of silent failure

Technical Details

  • Changed from .catch(() => {}) (silent failures) to .catch((error) => { ... }) (proper error handling)
  • Exit codes are now properly checked for spawned processes
  • Error messages clearly indicate the issue and suggest resolution steps

Testing

  • Tested clipboard copy on Linux with Wayland
  • Tested clipboard copy on Linux with X11
  • Tested clipboard copy on Windows
  • Tested clipboard copy on macOS
  • Verified error messages display correctly when tools are missing

Related Issues

Closes #[issue-number] (if applicable)

Checklist

  • Changes follow the project's contributing guidelines
  • Code is properly formatted
  • Error handling is comprehensive
  • User-facing messages are clear and helpful

… command exit codes, and providing specific messages when tools are missing.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found two related PRs that may be duplicate or closely related to PR #7220:

Potential Related PRs:

  1. PR fix(clipboard): add OSC 52 fallback for SSH/tmux environments #7028 - fix(clipboard): add OSC 52 fallback for SSH/tmux environments

  2. PR fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste #6370 - fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste

These PRs may have overlapping changes to the clipboard implementation or could be addressing the same underlying issues. I recommend reviewing these PRs to ensure there are no conflicting changes or duplicated efforts.

@ErvisTusha
Copy link
Author

fixed for 1.1.6 Linux/Ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant