Cannot copy to clipboard on Ubuntu 24.04
I'm using the v1.1.0 binary from the release section.
Here's a workaround:
$ code2prompt -o /dev/stdout my-folder/ | xclip -selection c
Issue persists in v2.0.0.
I made a workaround with ChatGPT. It's just a custom script that uses a temporary output file and uses cat to get it to the clipboard with xclip. https://chatgpt.com/share/66eadf1d-ab08-8003-8c10-385f1b4be36b
#!/bin/bash
# Create a temporary file
TMPFILE=$(mktemp)
# Run code2prompt with the provided options and save the output directly to the temp file using -o option
code2prompt "$@" -o "$TMPFILE"
# Output the contents of the file and pipe to xclip (clipboard)
cat "$TMPFILE" | xclip -selection clipboard
# Delete the temporary file
rm "$TMPFILE"
echo "Prompt copied to clipboard."
Same isssue in v2.0.0 (from cargo) for me. 6.8.0-45-generic #45~22.04.1-Ubuntu x86_64 GNU/Linux
Same issue in v2.0. (built from source) Linux isengard 6.6.57 #1-NixOS SMP PREEMPT_DYNAMIC Thu Oct 17 13:24:38 UTC 2024 x86_64 GNU/Linux
Hello, How can I reproduce the issue ?
It's working fine for me on GNOME, KDE, plasma and wayland. I was able to use code2prompt on WSL and on ARM (jetson orin).
@GregHilston @xu-yang16 @Theoabw @Mavial @tallesl
I have since deleted my use gard Nixos install unfortunately. I can try it on my WSL2 Nixos install and report back...
@ODAncona how is it supposed code2prompt to be used if connected via SSH, with no clipboard?
If started via SSH, I got following (no file.txt is created):
$ code2prompt . -o file.txt
▹▹▹▹▸ Done!
thread 'main' panicked at src/main.rs:198:50:
Failed to copy output to clipboard: XcbConnect(DisplayParsingError)
stack backtrace:
0: 0x5c24c26da49b - <unknown>
1: 0x5c24c254ec90 - <unknown>
2: 0x5c24c26d4453 - <unknown>
3: 0x5c24c26da234 - <unknown>
4: 0x5c24c26db700 - <unknown>
5: 0x5c24c26db41f - <unknown>
6: 0x5c24c26dbc1e - <unknown>
7: 0x5c24c26dbb22 - <unknown>
8: 0x5c24c26da996 - <unknown>
9: 0x5c24c26db884 - <unknown>
10: 0x5c24c24938f5 - <unknown>
11: 0x5c24c2493da3 - <unknown>
12: 0x5c24c253f8b3 - <unknown>
13: 0x5c24c2529963 - <unknown>
14: 0x5c24c2529ab9 - <unknown>
15: 0x5c24c26cbcf5 - <unknown>
16: 0x5c24c2543275 - <unknown>
17: 0x7c355f22a1ca - <unknown>
18: 0x7c355f22a28b - __libc_start_main
19: 0x5c24c24acf85 - <unknown>
20: 0x0 - <unknown>
Aborted
--no-clipboard with --output codebase.md