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

[WSL] Open in browser does not work #40

Open
ishaan-kapoor opened this issue Apr 18, 2024 · 6 comments
Open

[WSL] Open in browser does not work #40

ishaan-kapoor opened this issue Apr 18, 2024 · 6 comments

Comments

@ishaan-kapoor
Copy link

I am using bash with vi mode, in wsl and $BROWSER env variable is set.
When I press Ctrl+O, nothing happens, I also treid changing BROWSER to vim and still nothing changed.

@junegunn
Copy link
Owner

We use open on macOS and xdg-open in other systems to open URLs.

fzf-git.sh/fzf-git.sh

Lines 107 to 110 in 23a74ef

case "$(uname -s)" in
Darwin) open "$url$path" ;;
*) xdg-open "$url$path" ;;
esac

Maybe xdg-open is not available on your system? Please open a pull request if a different command is required.

@ishaan-kapoor
Copy link
Author

I use WSL and I have replaced the switch-case statement with the following line in my local copy

$BROWSER"$url$path"

And the BROWSER environment variable is set to 'explorer.exe microsoft-edge:'.

Note: There is no space between $BROWSER and "$url$path"

Should I identify WSL by uname -r and add a PR?

@junegunn
Copy link
Owner

A pull request is welcome.

By the way, I'm not sure why you're mentioning $BROWSER. This project doesn't use the variable.

@ishaan-kapoor
Copy link
Author

I am using the shell variable $BROWSER (set in my .bashrc) and as per this thread on SO, it is common practice.

@junegunn
Copy link
Owner

it is common practice

Maybe, but not on this project.

Note: There is no space between $BROWSER and "$url$path"

The examples shown in the linked SO thread all seem to require a space after it to work with arguments. e.g. export BROWSER='/home/username/lynx.sh'. So even if a program implements $BROWSER scheme, it will unlikely work for you as it will run something like $BROWSER "$url".

@ishaan-kapoor
Copy link
Author

It's a WSL issue, more specifically, I am using the browser form my native windows, and accessing it through WSL.
It seems like this is not a common practice as a minority of users have this configuration and this might create bugs for other WSL users who use browsers installed in WSL itself.

@junegunn junegunn changed the title Open in browser does not work [WSL] Open in browser does not work May 3, 2024
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