diff --git a/.gitignore b/.gitignore index 435d267..6da54f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -/src/build -/output -*.exe -*.zip -*.7z -.debug +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +/src/build +/output +/src/wsl-terminal +*.exe +*.zip +*.7z +.debug diff --git a/README.md b/README.md index 7231e36..7f10338 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # wsl-terminal -A terminal emulator for Windows Subsystem for Linux (WSL), based on [mintty](http://mintty.github.io/), [fatty](https://github.com/paolo-sz/fatty) and [wslbridge](https://github.com/rprichard/wslbridge). +A terminal emulator for Windows Subsystem for Linux (WSL), based on [mintty](http://mintty.github.io/), [fatty](https://github.com/paolo-sz/fatty) and [wslbridge2](https://github.com/Biswa96/wslbridge2). [中文页面](https://goreliu.github.io/wsl-terminal/README.zh_CN.html) @@ -12,7 +12,7 @@ More screenshots [here](https://github.com/goreliu/wsl-terminal/wiki/Screenshots ## Usage -1. [Download here](https://github.com/goreliu/wsl-terminal/releases), or run `bash -c "wget https://github.com/goreliu/wsl-terminal/releases/download/v0.8.13/wsl-terminal-0.8.13.7z && 7z x wsl-terminal-0.8.13.7z"` in `cmd.exe` or WSL. +1. [Download here](https://github.com/goreliu/wsl-terminal/releases), or run `bash -c "wget https://github.com/goreliu/wsl-terminal/releases/download/v0.9.0/wsl-terminal-0.9.0.7z && 7z x wsl-terminal-0.9.0.7z"` in `cmd.exe` or WSL. 2. Run `open-wsl.exe` to open a WSL terminal in current directory (need to be on a local NTFS volume, [more details](https://github.com/rprichard/wslbridge#building-wslbridge)). @@ -55,7 +55,7 @@ Usage: open-wsl [OPTION]... -h: show help. ``` -For `-B` and `-b`, see also [mintty params](https://github.com/goreliu/wsl-terminal/wiki/mintty-params) and [wslbridge params](https://github.com/rprichard/wslbridge#usage). +For `-B` and `-b`, see also [mintty params](https://github.com/goreliu/wsl-terminal/wiki/mintty-params) and [wslbridge2 params](https://github.com/Biswa96/wslbridge2#options). ### cmdtool (run it in WSL) @@ -80,7 +80,7 @@ Files in `tools` directory: | 1-remove-open-wsl-terminal-here-menu.js | Remove `Open wsl-terminal Here` context menu. | | 2-add-wsl-terminal-dir-to-path.js | Add `wsl-terminal` directory to `Path` environment variable. | | 2-remove-wsl-terminal-dir-from-path.js | Remove `wsl-terminal` directory from `Path` environment variable. | -| 3-write-distro-guids-to-config-file.js | Write distro guids to `etc/wsl-terminal.conf`. | +| 3-write-distro-to-config-file.js | Write distro guids to `etc/wsl-terminal.conf`. | | 4-create-start-menu-shortcut.js | Create a start menu shortcut to `open-wsl -C ~`. | | 4-create-start-menu-shortcut-login-shell.js | Create a start menu shortcut to `open-wsl -l`. | | 4-remove-all-start-menu-shortcuts.js | Remove all wsl-terminal start menu shortcuts. | @@ -99,7 +99,7 @@ title="my title" shell=/bin/bash use_tmux=0 ;icon= -;distro_guid= +;distro= ``` `etc/themes/*` are theme files, [use themes](https://github.com/goreliu/wsl-terminal/wiki/Use-themes). @@ -152,30 +152,28 @@ Ubuntu # Ubuntu is the default distro now > wslconfig /l Ubuntu (Default) -Legacy +kali-linux ``` -Or set `distro_guid` in wsl-terminal.conf (Won't change the default distro). +Or set `distro` in wsl-terminal.conf (Won't change the default distro). -Run `tools/3-write-distro-guids-to-config-file.js` ([help](https://github.com/goreliu/wsl-terminal#tools)), then a msgbox will show the result: +Run `tools/3-write-distro-to-config-file.js` ([help](https://github.com/goreliu/wsl-terminal#tools)), then a msgbox will show the result: ``` result has been written to ..\etc\wsl-terminal.conf: -; Legacy -;distro_guid={12345678-1234-5678-0123-456789abcdef} +;distro=kali-linux -; Ubuntu -;distro_guid={47a89313-4300-4678-96ae-e53c41a79e03} +;distro=Ubuntu -remove the ; before distro_guid to use the distro. +remove the ; before distro to use the distro. ``` If you want to pass the distro_guid to open-wsl in cmdline: ``` # pass the distro guid to wslbridge -> open-wsl -b "--distro-guid {47a89313-4300-4678-96ae-e53c41a79e03}" +> open-wsl -b "-d Ubuntu" ``` ## Links diff --git a/README.zh_CN.md b/README.zh_CN.md index fc07436..0d36dce 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -1,6 +1,6 @@ # wsl-terminal -用于 Windows Subsystem for Linux (WSL) 的终端模拟器,基于 [mintty](http://mintty.github.io/)、[fatty](https://github.com/paolo-sz/fatty) 和 [wslbridge](https://github.com/rprichard/wslbridge)。 +用于 Windows Subsystem for Linux (WSL) 的终端模拟器,基于 [mintty](http://mintty.github.io/)、[fatty](https://github.com/paolo-sz/fatty) 和 [wslbridge2](https://github.com/Biswa96/wslbridge2)。 [英文页面](https://goreliu.github.io/wsl-terminal/) @@ -12,7 +12,7 @@ ## 用法 -1. 从[这里](https://github.com/goreliu/wsl-terminal/releases)下载最新版本并解压,或者在 `cmd.exe` 或 WSL 里运行 `bash -c "wget https://github.com/goreliu/wsl-terminal/releases/download/v0.8.13/wsl-terminal-0.8.13.7z && 7z x wsl-terminal-0.8.13.7z"`。 +1. 从[这里](https://github.com/goreliu/wsl-terminal/releases)下载最新版本并解压,或者在 `cmd.exe` 或 WSL 里运行 `bash -c "wget https://github.com/goreliu/wsl-terminal/releases/download/v0.9.0/wsl-terminal-0.9.0.7z && 7z x wsl-terminal-0.9.0.7z"`。 2. 运行 `open-wsl.exe` 可以在当前目录打开一个 WSL 终端模拟器(wsl-terminal 需要放置在本地的 NTFS 分区上,[原因](https://github.com/rprichard/wslbridge#building-wslbridge))。 @@ -55,7 +55,7 @@ -h: 显示帮助信息。 ``` -`-B` 和 `-b` 后可以添加的选项,请参考 [mintty 参数](https://github.com/goreliu/wsl-terminal/wiki/mintty-params) 和 [wslbridge 参数](https://github.com/rprichard/wslbridge#usage)。 +`-B` 和 `-b` 后可以添加的选项,请参考 [mintty 参数](https://github.com/goreliu/wsl-terminal/wiki/mintty-params) 和 [wslbridge2 参数](https://github.com/Biswa96/wslbridge2#options)。 ### cmdtool(在 WSL 中运行) @@ -80,7 +80,7 @@ | 1-remove-open-wsl-terminal-here-menu.js | 移除 `Open wsl-terminal Here` 右键菜单。 | | 2-add-wsl-terminal-dir-to-path.js | 将 `wsl-terminal` 目录添加到 `Path` 环境变量里。 | | 2-remove-wsl-terminal-dir-from-path.js | 从 `Path` 环境变量中移除 `wsl-terminal` 目录。 | -| 3-write-distro-guids-to-config-file.js | 将所有发行版的 guid 写入到配置文件 `etc/wsl-terminal.conf` 中。 | +| 3-write-distro-to-config-file.js | 将所有发行版的 guid 写入到配置文件 `etc/wsl-terminal.conf` 中。 | | 4-create-start-menu-shortcut.js | 创建一个开始菜单快捷方式,指向 `open-wsl -C ~`。 | | 4-create-start-menu-shortcut-login-shell.js | 创建一个开始菜单快捷方式,指向 `open-wsl -l`。 | | 4-remove-all-start-menu-shortcuts.js | 移除所有 wsl-terminal 的开始菜单快捷方式。 | @@ -100,7 +100,7 @@ title="窗口标题" shell=/bin/bash use_tmux=0 ;icon= -;distro_guid= +;distro= ``` `etc/themes/` 目录下的是主题文件,[使用主题](https://github.com/goreliu/wsl-terminal/wiki/Use-themes)。 @@ -160,16 +160,14 @@ Legacy 如果你不想修改默认的发行版,可以在 `etc/wsl-terminal.conf` 里设置 `distro_guid`: -运行 `tools/3-write-distro-guids-to-config-file.js`([帮助](https://github.com/goreliu/wsl-terminal/blob/master/README.zh_CN.md#工具)),然后会有窗口弹出结果: +运行 `tools/3-write-distro-to-config-file.js`([帮助](https://github.com/goreliu/wsl-terminal/blob/master/README.zh_CN.md#工具)),然后会有窗口弹出结果: ``` result has been written to ..\etc\wsl-terminal.conf: -; Legacy -;distro_guid={12345678-1234-5678-0123-456789abcdef} +;distro=kali-linux -; Ubuntu -;distro_guid={47a89313-4300-4678-96ae-e53c41a79e03} +;distro=Ubuntu} remove the ; before distro_guid to use the distro. ``` @@ -179,8 +177,8 @@ remove the ; before distro_guid to use the distro. 如果你想通过命令行将 distro_guid 传递给 `open-wsl`: ``` -# 将 distro guid 传递给 wslbridge -> open-wsl -b "--distro-guid {47a89313-4300-4678-96ae-e53c41a79e03}" +# 将 distro 传递给 wslbridge +> open-wsl -b "--distro Ubuntu" ``` ## 链接 diff --git a/VERSION b/VERSION index c2f73c6..899f24f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.13 +0.9.0 \ No newline at end of file diff --git a/src/check-update.sh b/src/check-update.sh index cc9e4d5..d2f147f 100755 --- a/src/check-update.sh +++ b/src/check-update.sh @@ -6,12 +6,12 @@ cygwin_version="$(curl http://mirrors.kernel.org/sourceware/cygwin/x86_64/releas mintty_version="$(curl http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/mintty/sha512.sum \ 2>/dev/null | grep -Po '\d\.\d\.\d-\d' | tail -n 1)" -wslbridge_version="$(curl https://github.com/rprichard/wslbridge/releases \ - 2>/dev/null | grep -Po '\d\.\d\.\d-cygwin64\.tar\.gz' | cut -d- -f1 | head -n 1)" +wslbridge2_version="$(curl https://github.com/Biswa96/wslbridge2/releases \ + 2>/dev/null | grep -Po 'wslbridge2\/releases\/tag\/v\d\.\d' | cut -dv -f2 | head -n 1)" sed -i -e "s/^cygwin_version=.*$/cygwin_version=\"$cygwin_version\"/g" \ -e "s/^mintty_version=.*$/mintty_version=\"$mintty_version\"/g" \ - -e "s/^wslbridge_version=.*$/wslbridge_version=\"$wslbridge_version\"/g" \ + -e "s/^wslbridge2_version=.*$/wslbridge2_version=\"$wslbridge2_version\"/g" \ prepare.sh index=1 @@ -19,7 +19,7 @@ index=1 git diff | grep "^+mintty_version" >/dev/null \ && echo "$((index++)).Upgrade mintty to [${mintty_version%-*}](https://github.com/mintty/mintty/releases/tag/${mintty_version%-*})." -git diff | grep "^+wslbridge_version" >/dev/null \ - && echo "$((index++)).Upgrade wslbridge to [$wslbridge_version](https://github.com/rprichard/wslbridge/releases/tag/$wslbridge_version)." +git diff | grep "^+wslbridge2_version" >/dev/null \ + && echo "$((index++)).Upgrade wslbridge2 to [${wslbridge2_version}](https://github.com/Biswa96/wslbridge2/releases/tag/${wslbridge2_version})." exit 0 diff --git a/src/cmdtool b/src/cmdtool index 8ac7322..28de1cf 100755 --- a/src/cmdtool +++ b/src/cmdtool @@ -123,7 +123,7 @@ elif [[ "$1" == update ]]; then echo OK exit elif [[ "$1" == "killall" ]]; then - killall sleep wslbridge-backend bash tmux zsh + killall sleep wslbridge2-backend bash tmux zsh elif [[ "$1" == "install" ]]; then if [[ "$2" == "dash" ]]; then version=0.5.9.1-1 diff --git a/src/etc/wsl-terminal.conf b/src/etc/wsl-terminal.conf index 02e5b22..a87ec56 100644 --- a/src/etc/wsl-terminal.conf +++ b/src/etc/wsl-terminal.conf @@ -28,5 +28,5 @@ keep_wsl_running=0 ; To use Ubuntu icon, uncomment the above line, and replace username with yours. ; To use mintty default icon, set icon=C:\path\to\wsl-terminal\bin\mintty.exe -; Run tools/3-write-distro-guids-to-config-file.js to generate the distro_guid config. -;distro_guid= +; Run tools/3-write-distro-to-config-file.js to generate the distro_guid config. +;distro= diff --git a/src/open-wsl.ahk b/src/open-wsl.ahk index b5dcd7c..82d204b 100644 --- a/src/open-wsl.ahk +++ b/src/open-wsl.ahk @@ -8,28 +8,28 @@ IniRead, shell, %ini_file%, config, shell, "bash" IniRead, use_tmux, %ini_file%, config, use_tmux, 0 IniRead, mintty_options, %ini_file%, config, mintty_options, IniRead, icon, %ini_file%, config, icon, -IniRead, distro_guid, %ini_file%, config, distro_guid, +IniRead, distro, %ini_file%, config, distro, IniRead, keep_wsl_running, %ini_file%, config, keep_wsl_running, 0 if (mintty_options == "ERROR") { mintty_options = } -; Prepare mintty_base and wslbridge_base {{{1 + +; Prepare mintty_base and wslbridge2_base {{{1 icon_path = %A_ScriptFullPath% if (icon != "" && FileExist(icon)) { icon_path = %icon% } distro_option := "" -if (distro_guid != "ERROR") { - distro_option = --distro-guid %distro_guid% +if (distro != "ERROR") { + distro_option = -d %distro% } mintty_path = "%A_ScriptDir%\bin\mintty" -mintty_base = %mintty_path% --wsl --rootfs=// --configdir "%A_ScriptDir%\etc" -i "%icon_path%" -wslbridge_base = -e /bin/wslbridge %distro_option% -e SHELL="%shell%" -e LANG - +mintty_base = %mintty_path% -i "%icon_path%" --rootfs=// --configdir "%A_ScriptDir%\etc" +wslbridge2_base = --WSLmode -e /bin/wslbridge2 %distro_option% -e SHELL=%shell% -e LANG ; Run as run-wsl-file or any editor {{{1 SplitPath, A_ScriptName, , , , exe_name if (exe_name == "run-wsl-file") { @@ -43,7 +43,7 @@ if (exe_name == "run-wsl-file") { SplitPath, arg, filename, dir SetWorkingDir, %dir% - Run, %mintty_base% %mintty_options% -t "%arg%" %wslbridge_base% -t ./"%filename%" + Run, %mintty_base% %mintty_options% -t "%arg%" %wslbridge2_base% ./"%filename%" ExitApp } else if (exe_name != "open-wsl" && exe_name != "cmd") { ; editor @@ -67,7 +67,7 @@ if (exe_name == "run-wsl-file") { } } - Run, %mintty_base% %mintty_options% -t "%filepath%" %wslbridge_base% -t "%exe_name%" %options% %filename% + Run, %mintty_base% %mintty_options% -t "%filepath%" %wslbridge2_base% "%exe_name%" %options% %filename% Loop, 5 { WinActivate, %filepath% @@ -92,7 +92,7 @@ activate_window := False change_directory := "" distro := "" login_shell := False -wslbridge_options := "" +wslbridge2_options := "" user_command := "" i := 0 @@ -125,11 +125,11 @@ while (i++ < argc) { distro := args[i] } else if (c == "-b") { if (argc < ++i) { - MsgBox, 0x10, , Require additional wslbridge options arg. + MsgBox, 0x10, , Require additional wslbridge2 options arg. ExitApp, 1 } - wslbridge_options := args[i] + wslbridge2_options := args[i] } else if (c == "-B") { if (argc < ++i) { MsgBox, 0x10, , Require additional mintty options arg. @@ -179,10 +179,10 @@ while (i++ < argc) { if (user_command != "") { if (change_directory != "") { - wslbridge_options = %wslbridge_options% -C "%change_directory%" + wslbridge2_options = %wslbridge2_options% -W "%change_directory%" } - Run, %mintty_base% %mintty_options% -t "%user_command%" %wslbridge_base% %wslbridge_options% -t %shell% -c "%user_command%" + Run, %mintty_base% %mintty_options% -t "%user_command%" %wslbridge2_base% %wslbridge2_options% %shell% -c "%user_command%" ExitApp } @@ -202,7 +202,7 @@ if (distro != "") { ; Build command line {{{1 cmd = -opts = %wslbridge_options% -t +opts = %wslbridge2_options% if (activate_window && WinExist(title)) { } else if (!use_tmux) { @@ -228,17 +228,17 @@ if (activate_window && WinExist(title)) { } if (change_directory != "") { - opts = %opts% -C "%change_directory%" + opts = %opts% -W "%change_directory%" } if (cmd != "") { - lnk_args = %mintty_base% %mintty_options% -t "%title%" %wslbridge_base% %opts% %cmd% + lnk_args = %mintty_base% %mintty_options% -t "%title%" %wslbridge2_base% %opts% %cmd% lnk_args := StrReplace(lnk_args, mintty_path) FileCreateShortcut, %A_ScriptDir%\bin\mintty.exe, %A_ScriptDir%\wsl-terminal.lnk, %A_WorkingDir%, %lnk_args%, wsl-terminal temp shortcut, %icon_path% Run, %A_ScriptDir%\wsl-terminal.lnk - ;Run, %mintty_base% %mintty_options% -t "%title%" %wslbridge_base% %opts% %cmd% + ;Run, %mintty_base% %mintty_options% -t "%title%" %wslbridge2_base% %opts% %cmd% } ; Activate window {{{1 diff --git a/src/prepare.sh b/src/prepare.sh index b0e39d1..fb1e1ff 100755 --- a/src/prepare.sh +++ b/src/prepare.sh @@ -2,10 +2,10 @@ set -e -cygwin_version="3.0.6-1" -mintty_version="3.0.0-1" +cygwin_version="3.1.2-1" +mintty_version="3.1.0-1" fatty_version="r2253.5a9c340-1" -wslbridge_version="0.2.4" +wslbridge2_version="0.5" # wget tar xz gzip p7zip @@ -24,7 +24,7 @@ mkdir -p build && cd build wget -nc http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/cygwin/cygwin-${cygwin_version}.tar.xz wget -nc http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/mintty/mintty-${mintty_version}.tar.xz wget -nc https://github.com/goreliu/fatty-prebuilds/releases/download/${fatty_version}/fatty-${fatty_version}.7z -wget -nc https://github.com/rprichard/wslbridge/releases/download/${wslbridge_version}/wslbridge-${wslbridge_version}-cygwin64.tar.gz +wget -nc https://github.com/Biswa96/wslbridge2/releases/download/v${wslbridge2_version}/wslbridge2_cygwin_x86_64.7z wget -nc https://autohotkey.com/download/ahk.zip rm -rf bin etc usr doc @@ -37,13 +37,10 @@ tar -xvf cygwin-${cygwin_version}.tar.xz \ tar -xvf mintty-${mintty_version}.tar.xz usr/bin/mintty.exe usr/share/doc usr/share/mintty/lang 7z x -y fatty-${fatty_version}.7z fatty/bin/{fatty.exe,cyggcc_s-seh-1.dll,cygstdc++-6.dll} fatty/doc fatty/etc/lang -tar -xvf wslbridge-${wslbridge_version}-cygwin64.tar.gz -cd wslbridge-${wslbridge_version}-cygwin64 -mv wslbridge.exe wslbridge-backend ../usr/bin -mkdir -p ../usr/share/doc/wslbridge -mv BuildInfo.txt LICENSE.txt README.md ../usr/share/doc/wslbridge -cd .. -rmdir wslbridge-${wslbridge_version}-cygwin64 + +7z x -y wslbridge2_cygwin_x86_64.7z -ousr/bin +mkdir -p usr/share/doc/wslbridge2 +wget -nc https://raw.githubusercontent.com/Biswa96/wslbridge2/v${wslbridge2_version}/LICENSE -Ousr/share/doc/wslbridge2/LICENSE cp -r ../etc . rm -rf bin doc diff --git a/src/tools/3-write-distro-guids-to-config-file.js b/src/tools/3-write-distro-to-config-file.js similarity index 87% rename from src/tools/3-write-distro-guids-to-config-file.js rename to src/tools/3-write-distro-to-config-file.js index 0510883..d6d8281 100644 --- a/src/tools/3-write-distro-guids-to-config-file.js +++ b/src/tools/3-write-distro-to-config-file.js @@ -16,7 +16,7 @@ for (var i = 0; i < output.length; ++i) { var name = WshShell.RegRead(output[i] + "\\DistributionName"); var guid = output[i].substr(lxssPos + 5); - result += "\r\n; " + name + "\r\n;distro_guid=" + guid + "\r\n"; + result += "\r\n;distro=" + name + "\r\n;distro_guid " + guid + "\r\n"; } if (result == "") { @@ -35,4 +35,4 @@ var file = FSO.OpenTextFile(conf, 8, false); file.Write(result); file.Close(); WScript.Echo("result has been written to ..\\etc\\wsl-terminal.conf:\n" - + result + "\nremove the ; before distro_guid to use the distro."); + + result + "\nremove the ; before distro to use the distro.");