Last active
March 13, 2021 10:34
-
-
Save valin4tor/87bda8a6cdc1136df3d4469fd454c16d to your computer and use it in GitHub Desktop.
Chrome WSL wrapper script for Cypress (place in /usr/bin/chrome)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" == "--version" ]; then | |
version=$(reg.exe query 'HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon' /v version | grep version) | |
echo $version | sed -r -e 's/version\s+REG_SZ\s+/Google Chrome /' | |
exit | |
fi | |
userprofile=$(cmd.exe /C 'echo %userprofile%' | tr -d '\r\n') | |
cypress_folder="$HOME/.config/Cypress" | |
if [ -d $cypress_folder ] && [ ! -L $cypress_folder ]; then | |
mv $cypress_folder "$(wslpath $userprofile)/Cypress" | |
ln -s "$(wslpath $userprofile)/Cypress" $cypress_folder | |
fi | |
args=${@//$cypress_folder/$userprofile\/Cypress} | |
exec winrun chrome $args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation:
.bashrc
:export DISPLAY=:0.0
(if necessary, modify the number to suit your X server configuration)/usr/bin/chrome
in your WSL distrosudo chmod +x /usr/bin/chrome
Usage: