Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to configure clipboard copy (pbcopy) functionality on macOS with Wezterm #2097

Open
3 tasks done
sujitawake opened this issue Dec 24, 2024 · 0 comments
Open
3 tasks done
Labels
bug Something isn't working

Comments

@sujitawake
Copy link

What system are you running Yazi on?

macOS

What terminal are you running Yazi in?

Wezterm

yazi --debug output

Yazi
    Version: 0.4.2 (5cfcab3 2024-12-20)
    Debug  : false
    Triple : aarch64-apple-darwin (macos-aarch64)
    Rustc  : 1.83.0 (90b35a62 2024-11-26)

Ya
    Version: 0.4.2 (5cfcab3 2024-12-20)

Emulator
    Brand.from_env      : Some(WezTerm)
    Emulator.detect     : Emulator { kind: Left(WezTerm), light: false, cell_size: Some((17, 35)) }
    Emulator.detect_full: Ok(Emulator { kind: Left(WezTerm), light: false, cell_size: Some((17, 35)) })

Adapter
    Adapter.matches: Iip

Desktop
    XDG_SESSION_TYPE           : None
    WAYLAND_DISPLAY            : None
    DISPLAY                    : None
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

NVIM
    NVIM          : false
    Neovim version: 0.10.3

Variables
    SHELL           : Some("/bin/zsh")
    EDITOR          : Some("/opt/homebrew/bin/nvim")
    VISUAL          : Some("/opt/homebrew/bin/nvim")
    YAZI_FILE_ONE   : None
    YAZI_CONFIG_HOME: None
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: Some("\n--layout=reverse\n--info=inline\n--height=80%\n--multi\n--preview-window=:hidden\n--preview \'([[ -f {} ]] && (bat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2> /dev/null | head -200\'\n--color=\'hl:148,hl+:154,pointer:032,marker:010,bg+:237,gutter:008\'\n--prompt=\'∼ \' --pointer=\'▶\' --marker=\'✓\'\n--bind \'?:toggle-preview\'\n--bind \'ctrl-a:select-all\'\n--bind \'ctrl-y:execute-silent(echo {+} | pbcopy)\'\n--bind \'ctrl-e:execute(echo {+} | xargs -o vim)\'\n--bind \'ctrl-v:execute(code {+})\'\n")

Text Opener
    default     : Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-create: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-rename: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

Multiplexers
    TMUX               : 0
    tmux version       : 3.4
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : 0.41.2

Dependencies
    file          : 5.41
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 7.1 / 7.1
    pdftoppm      : 24.12.0
    magick        : 7.1.1-42
    fzf           : 0.57.0
    fd/fdfind     : 10.2.0 / No such file or directory (os error 2)
    rg            : 14.1.1
    chafa         : No such file or directory (os error 2)
    zoxide        : No such file or directory (os error 2)
    7z/7zz        : 17.05 / No such file or directory (os error 2)
    jq            : 1.7.1

Clipboard
    wl-copy/paste: No such file or directory (os error 2) / No such file or directory (os error 2)
    xclip        : No such file or directory (os error 2)
    xsel         : No such file or directory (os error 2)

Describe the bug

Issue Description

Is there a recommended way to configure clipboard operations for macOS users? Or is this potentially a bug in how Yazi 0.4.2 interacts with macOS clipboard operations?

I am unable to configure Yazi to copy file contents to system clipboard using pbcopy. The native macOS clipboard command pbcopy works correctly in the terminal (echo "test" | pbcopy functions as expected), but cannot get it working within Yazi's configuration.

Attempted Configurations

I've tried multiple approaches in yazi.toml, but none have worked:

Attempt 1

[[manager.prepend_keymap]]
on = "y"
exec = "shell"
args = { cmd = "cat \"{}\" | pbcopy && echo 'Copied to clipboard!'" }

Attempt 2

[[manager.prepend_keymap]]
on = "y"
run = [
    "shell 'cat \"$@\" | pbcopy'",
    "yank"
]
desc = "Copy file contents to clipboard"

Attempt 3

[[manager.prepend_keymap]]
on = "y"
run = "shell '/bin/zsh -c \"cat \\\"$@\\\" | pbcopy\"'"
desc = "Copy file contents to clipboard"

Attempt 4

[[manager.prepend_keymap]]
on = "y"
exec = "shell"
args = { command = "cat $YAZI_CURRENT_FILE | pbcopy" }

Current Behavior

None of the configurations result in the file contents being copied to the clipboard. No error messages are displayed in the status bar.

Minimal reproducer

  1. Append config entries to yazi.toml with:
[[manager.prepend_keymap]]
on = "y"
exec = "shell"
args = { cmd = "cat \"{}\" | pbcopy" }
  1. Create a test file:
echo "test content" > test.txt
  1. Steps to reproduce:
  • Start yazi
  • Navigate to test.txt
  • Press 'y'
  • Try to paste in any text editor

Expected: The content "test content" should be in clipboard
Actual: Nothing is copied to clipboard

Anything else?

No response

Checklist

  • I tried the latest nightly build, and the issue is still reproducible
  • I updated the debug information (yazi --debug) input box to the nightly that I tried
  • I can reproduce it after disabling all custom configs/plugins (mv ~/.config/yazi ~/.config/yazi-backup)
@sujitawake sujitawake added the bug Something isn't working label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant