Vscode about xclip

this is my computer inforamtion:

this is vscode information:

I need to upload images from the clipboard to my blog. VS Code prompted me that I need xclip, so I downloaded xclip.

I installed xclip, but it’s still not working

my computer here:

image

vscode terminal here:

I added the following code in ~/.bashrc base on the Al’s suggestion:

# xclip configure by rock 12/11/25
alias copy="xclip -selection clipboard"
alias paste="xclip -selection clipboard -o"

but this don’t slove my question.

and the I run the following command base on the AI’s suggestion:

echo "DISPLAY=$DISPLAY"
echo "WAYLAND_DISPLAY=$WAYLAND_DISPLAY"
echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"

my computer here

vscode terminal here

I only found the difference between my computer terminal and the VS code terminal, but I don’t know what to do for the next step, please someone can tell me how to fix this.

You’re using Wayland and so xclip wlll not work for you as it’s for written for the X display manager.

wl-copy is probably going to be more useful for you.

Never trust AI. It’s a pile of shite.

Vscode running as flatpak?

I don’t know, this is where I installed :https://code.visualstudio.com/

Thank you for your replay, I know it, I will try other way.

  1. You say you installed VSCode from https://code.visualstudio.com , but the output of your which command indicates that you are running a flatpak. Uninstall the flatpak. Install the rpm. When VS Code is run as a Flatpak, its integrated terminal inherits the Flatpak sandbox environment, not your host system’s environment. Inside a Flatpak sandbox, /usr refers to the Flatpak runtime, not the host’s /usr.
  2. xclip works on systems that run Wayland. You don’t need to switch to wl-copy.
  3. Test xclip outside of VSCode to confirm. echo Hello | xclip -sel c.

To learn more, and explore workarounds for if you still want to use a Flatpak, use this prompt in your favorite AI chat bot or search engine:

I’m running VSCode from a flatpak installation. I’m finding that binaries I installed into /usr/bin are not on the PATH when I open the terminal that is integrated in VSCode.

Example response (from gemini.google.com).

thank you for your reply, I will install the rmp, please give me a website about rmp.
because I seem installed from https://code.visualstudio.com, and click Download for Linux(.rpm), and then :


is it right? If I’m wrong, please point it out.

I’m going to reinstall it this way to see whether I get the Flatpak version of VS Code. I’ve completely forgotten how I downloaded it before.

Yes, you are on the right track towards installing the rpm of VSCode.

The output you showed in your first post of which xclip includes directories like /home/rock/.var/app/com.visualstudio.code which indicate that you are running the flatpak version of vscode.

In a terminal, list installed flatpaks by executing:

flatpak list

You should see this line in the output:

Visual Studio Code   com.visualstudio.code    1.107.0  stable  system

Uninstall the VSCode flatpak:

flatpak uninstall com.visualstudio.code

Then follow the website instructions you found for installing the VSCode rpm.

I’ve completely forgotten how I downloaded it before

Tip: Always start a new Google Doc (or similar) for each software package that you install. In it keep installation and usage notes that your can refer to the next time you need to install the software. System Administrators always keep meticulous notes. You are the System Administrator of your laptop. Do so now for rpm, dnf, flatpak and VSCode.

1 Like

Thank you very much. You’ve not only sloved my problem and also provided some helpful tips. :smiling_face_with_three_hearts:

1 Like

Glad to hear.

So you got xclip working in the VSCode integrated terminal now?

If so, you can mark the solution reply as a solution so that others can easily find it in the future.

yeah, I see.

1 Like