Skip to content

Conversation

@tomKPZ
Copy link

@tomKPZ tomKPZ commented Jan 3, 2023

The default mode of the kitty terminal is to wait until output from all subprocesses is finished before closing. This means running wl-copy asdf; exit will exit the shell but cause kitty to hang as it waits for wl-copy to output. This change closes stderr to prevent this issue.

The default mode of the kitty terminal is to wait until output
from all subprocesses is finished before closing.  This means
running `wl-copy asdf; exit` will exit the shell but cause
kitty to hang as it waits for wl-copy to output.  This change
closes stderr to prevent this issue.
@bugaevc
Copy link
Owner

bugaevc commented Jan 3, 2023

Hi!

This has been proposed before (see #110), and I'm still not convinced this is a good idea.

@kovidgoyal
Copy link

Use

echo asdf | kitty +kitten clipboard

instead, when running inside kitty. There is no need to use WM specific tools for copying to clipboard.

@lilydjwg
Copy link

lilydjwg commented Jan 21, 2024

Not closing stderr will leave a ssh command having called wl-copy to hang there until something else has copied.

Also, doing a 2>/dev/null redirection is awkward because it has to be quoted on the ssh command line, which prevents code highlight and shell-word movements.

landonb added a commit to landonb/home-fries that referenced this pull request Nov 16, 2025
- The wl-copy command hangs when run over SSH, unless SSH'd
  to the same host as the desktop manager (even if you SSH
  to a remote host, and then SSH back to your original host).

  - This is a known issue:

    bugaevc/wl-clipboard#154

- I also fixed some syntax errors in the elif conditionals.

  - Specifically, unquoted -n tests are always true! e.g.,

      [ -n ${undefined_variable} ]

    is always true.

    - (Oof! How embarrassing)

            (,,>﹏<,,)

  - So the wl-copy elif's were always running on GNOME Shell,
    regardless of $WAYLAND_DISPLAY being declared or not.

  - But now this is fixed, and I've added an additional elif
    to check if the SSH session is connected to the originating
    desktop host or not, so we can avoid hanging because of
    the wl-copy issue referenced above.

- Finally, the clipboard copy pipeline will now warn-tell if the
  clipboard is inaccessible... Although I may revert this change
  soon. But I'd like to demo it for now. (Homefries defines some
  helpful copy pipeline commands like `pp` to print and copy the
  `pwd`; and DepoXy also defines some helpful copy pipeline cmds,
  like `fdp` to print and copy the result from the `fd` cmd, and
  `stp` to print/copy output from the `git status` command, etc.
  And while I don't think I normally run these commands over SSH,
  I'm not certain, so I don't expect to see the new warn message
  very often. Or maybe I'm wrong & I will; I guess I'll FA & FO.)
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.

4 participants