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

Could not make it to work #2

Closed
sdancer75 opened this issue Nov 2, 2022 · 5 comments
Closed

Could not make it to work #2

sdancer75 opened this issue Nov 2, 2022 · 5 comments

Comments

@sdancer75
Copy link

I installed the script and I verified that there is inside my home dir.

I changed the .profile with this but every time I press Ctr+V to paste I get the copied text from the windows clipboard. Where am I wrong with this?

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

#export DISPLAY="$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0"
#export CHOKIDAR_USEPOLLING=true

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

[ -z ${WSLENV+x} ] || export PATH="${PATH:+"$PATH:"}$HOME/bin/win-bash-xclip-xsel"
@Konfekt
Copy link
Owner

Konfekt commented Nov 2, 2022

Hello @sdancer75, by the line

[ -z ${WSLENV+x} ] || export PATH="${PATH:+"$PATH:"}$HOME/bin/win-bash-xclip-xsel"

and having all files in $HOME/bin/win-bash-xclip-xsel you override xclip and xsel to use the Windows clip board inside WSL instead of the WSL clipboard. The Ctrl-V key binding for pasting text is not affected.
I am not sure what you want to achieve.

@sdancer75
Copy link
Author

Hi

I just redirected from the answer post zyedidia/micro#2184 (comment) and I thought that it was the solution for pasting data inside the micro editor.

Regards,

@Konfekt
Copy link
Owner

Konfekt commented Nov 2, 2022

Yes, indeed, according to

For interfacing with the local system clipboard, the following tools need to be installed:

For X11 xclip or xsel
For Wayland wl-clipboard

Without these tools installed, micro will use an internal clipboard for copy and paste, but it won't be accessible to external applications.

it uses xclip or xsel, and if you find them to be in your $PATH, then Ctrl-V should supposedly work.

I gues you already have either one installed ?
You can check by type -a xclip (or xsel).
If so, either uninstall, or put the path of the scripts in this repo first in $PATH, say by

export PATH="$HOME/bin/win-bash-xclip-xsel:$PATH"

@sdancer75
Copy link
Author

sdancer75 commented Nov 2, 2022

I am on WSL2. Despite the internal/external clipboard settings with micro editor, I could not copy/paste with ctrl+c/ctrl+v. Instead, I could only paste the copied text from the host (win10).

I changed my .profile according to your recommendation and it worked just fine. Excellent, thanks!

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

#export DISPLAY="$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0"
#export CHOKIDAR_USEPOLLING=true

export PATH="$HOME/bin/win-bash-xclip-xsel:$PATH"

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Konfekt added a commit that referenced this issue Nov 2, 2022
@Konfekt
Copy link
Owner

Konfekt commented Nov 2, 2022

I am glad to know. I documented this workaround in the Readme.

@Konfekt Konfekt closed this as completed Nov 2, 2022
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

No branches or pull requests

2 participants