mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
Merge pull request #2897 from daxgames/windows_terminal
Applying the windows terminal branch to the development
This commit is contained in:
commit
e01a553ca5
24
.github/workflows/build.yml
vendored
24
.github/workflows/build.yml
vendored
@ -50,7 +50,26 @@ jobs:
|
||||
- name: Pack the built files
|
||||
shell: pwsh
|
||||
working-directory: scripts
|
||||
run: .\pack.ps1 -verbose
|
||||
run: .\pack.ps1 -verbose -emulator all
|
||||
|
||||
- name: Upload artifact (cmder_wt.zip)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: build/cmder_wt.zip
|
||||
name: cmder_wt.zip
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload artifact (cmder_wt.7z)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: build/cmder_wt.7z
|
||||
name: cmder_wt.7z
|
||||
|
||||
- name: Upload artifact (cmder_wt_mini.zip)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: build/cmder_wt_mini.zip
|
||||
name: cmder_wt_mini.zip
|
||||
|
||||
- name: Upload artifact (cmder.zip)
|
||||
uses: actions/upload-artifact@v3
|
||||
@ -82,8 +101,11 @@ jobs:
|
||||
with:
|
||||
files: |
|
||||
build/cmder.zip
|
||||
build/cmder_wt.zip
|
||||
build/cmder.7z
|
||||
build/cmder_wt.7z
|
||||
build/cmder_mini.zip
|
||||
build/cmder_wt_mini.zip
|
||||
build/hashes.txt
|
||||
draft: true
|
||||
generate_release_notes: true
|
||||
|
74
Cmder.bat
74
Cmder.bat
@ -1,20 +1,66 @@
|
||||
@echo off
|
||||
|
||||
SET CMDER_ROOT=%~dp0
|
||||
|
||||
set CMDER_TERMINAl=conemu
|
||||
if exist "%CMDER_ROOT%\vendor\windows-terminal\windowsterminal.exe" (
|
||||
SET CMDER_TERMINAL=windows-terminal
|
||||
)
|
||||
|
||||
if NOT "%~1" == "" (
|
||||
SET CMDER_TERMINAL=%~1
|
||||
shift
|
||||
)
|
||||
|
||||
:: Remove Trailing '\'
|
||||
@if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1%
|
||||
if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1%
|
||||
|
||||
if not exist "%CMDER_ROOT%\config" md "%CMDER_ROOT%\config" 2>nul
|
||||
|
||||
call :%CMDER_TERMINAL%
|
||||
exit /b
|
||||
|
||||
:conemu
|
||||
if not exist "%CMDER_ROOT%\config\user_ConEmu.xml" (
|
||||
copy "%CMDER_ROOT%\vendor\ConEmu.xml.default" "%CMDER_ROOT%\config\user_ConEmu.xml" 1>nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo ERROR: CMDER Initialization has Failed
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
if exist "%~1" (
|
||||
start %cmder_root%\vendor\conemu-maximus5\ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1"
|
||||
) else (
|
||||
start %cmder_root%\vendor\conemu-maximus5\ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\user_ConEmu.xml"
|
||||
)
|
||||
exit /b
|
||||
|
||||
:windows-terminal
|
||||
if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings" md "%CMDER_ROOT%\vendor\windows-terminal\settings" 2>nul
|
||||
if not exist "%CMDER_ROOT%\vendor\windows-terminal\.portable" echo "This makes this installation of Windows Terminal portable" >"%CMDER_ROOT%\vendor\windows-terminal\.portable" 2>nul
|
||||
|
||||
if exist "%CMDER_ROOT%\config\user_windows_terminal_settings.json" (
|
||||
if not exist "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" (
|
||||
echo "Copying user Windows Terminal settings to '%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json'..."
|
||||
copy "%CMDER_ROOT%\config\user_windows_terminal_settings.json" "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" 1>nul
|
||||
)
|
||||
) else if not exist "%CMDER_ROOT%\config\user_windows_terminal_settings.json" (
|
||||
if not exist "%CMDER_ROOT%\config" mkdir "%CMDER_ROOT%\config" 2>nul
|
||||
echo "Copying default Windows Terminal settings to '%CMDER_ROOT%\config'..."
|
||||
copy "%CMDER_ROOT%\vendor\windows_terminal_default_settings.json" "%CMDER_ROOT%\config\user_windows_terminal_settings.json" 1>nul
|
||||
echo "Copying default Windows Terminal settings to '%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json'..."
|
||||
copy "%CMDER_ROOT%\vendor\windows_terminal_default_settings.json" "%CMDER_ROOT%\vendor\windows-terminal\settings\settings.json" 1>nul
|
||||
|
||||
if %errorlevel% neq 0 (
|
||||
echo ERROR: CMDER Initialization has Failed
|
||||
exit /b 1
|
||||
)
|
||||
) else if exist "%cmder_root%\vendor\windows-terminal\settings\settings.json" (
|
||||
copy "%cmder_root%\vendor\windows-terminal\settings\settings.json" "%CMDER_ROOT%\config\user_windows_terminal_settings.json"
|
||||
)
|
||||
|
||||
start %cmder_root%\vendor\windows-terminal\windowsterminal.exe
|
||||
exit /b
|
||||
|
||||
if not exist "%CMDER_ROOT%\config\user_ConEmu.xml" (
|
||||
if not exist "%CMDER_ROOT%\config" mkdir "%CMDER_ROOT%\config" 2>nul
|
||||
copy "%CMDER_ROOT%\vendor\ConEmu.xml.default" "%CMDER_ROOT%\config\user_ConEmu.xml" 1>nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo ERROR: CMDER Initialization has Failed
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
if exist "%~1" (
|
||||
start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1"
|
||||
) else (
|
||||
start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\user_ConEmu.xml"
|
||||
)
|
||||
|
@ -117,7 +117,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
wchar_t cpuCfgPath[MAX_PATH] = { 0 };
|
||||
wchar_t userCfgPath[MAX_PATH] = { 0 };
|
||||
wchar_t defaultCfgPath[MAX_PATH] = { 0 };
|
||||
wchar_t conEmuPath[MAX_PATH] = { 0 };
|
||||
wchar_t terminalPath[MAX_PATH] = { 0 };
|
||||
wchar_t configDirPath[MAX_PATH] = { 0 };
|
||||
wchar_t userConfigDirPath[MAX_PATH] = { 0 };
|
||||
wchar_t userBinDirPath[MAX_PATH] = { 0 };
|
||||
@ -128,12 +128,15 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
wchar_t legacyUserAliasesPath[MAX_PATH] = { 0 };
|
||||
wchar_t args[MAX_PATH * 2 + 256] = { 0 };
|
||||
wchar_t userConEmuCfgPath[MAX_PATH] = { 0 };
|
||||
wchar_t windowsTerminalDir[MAX_PATH] = { 0 };
|
||||
wchar_t conEmuDir[MAX_PATH] = { 0 };
|
||||
wchar_t emulatorPath[MAX_PATH] = { 0 };
|
||||
|
||||
|
||||
std::wstring cmderStart = path;
|
||||
std::wstring cmderTask = taskName;
|
||||
std::wstring cmderTitle = title;
|
||||
std::wstring cmderConEmuArgs = conemu_args;
|
||||
std::wstring cmderTerminalArgs = conemu_args;
|
||||
|
||||
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
||||
userConfigDirPath[cfgRoot.length()] = 0;
|
||||
@ -166,8 +169,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
PathCombine(userProfilePath, configDirPath, L"user_profile.cmd");
|
||||
|
||||
char *lPr = (char *)malloc(MAX_PATH);
|
||||
char *pR = (char *)malloc(MAX_PATH);
|
||||
char* lPr = (char*)malloc(MAX_PATH);
|
||||
char* pR = (char*)malloc(MAX_PATH);
|
||||
size_t i;
|
||||
wcstombs_s(&i, lPr, (size_t)MAX_PATH,
|
||||
legacyUserProfilePath, (size_t)MAX_PATH);
|
||||
@ -184,8 +187,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd");
|
||||
|
||||
char *lPr = (char *)malloc(MAX_PATH);
|
||||
char *pR = (char *)malloc(MAX_PATH);
|
||||
char* lPr = (char*)malloc(MAX_PATH);
|
||||
char* pR = (char*)malloc(MAX_PATH);
|
||||
size_t i;
|
||||
wcstombs_s(&i, lPr, (size_t)MAX_PATH,
|
||||
legacyUserAliasesPath, (size_t)MAX_PATH);
|
||||
@ -222,8 +225,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd");
|
||||
|
||||
char *lPr = (char *)malloc(MAX_PATH);
|
||||
char *pR = (char *)malloc(MAX_PATH);
|
||||
char* lPr = (char*)malloc(MAX_PATH);
|
||||
char* pR = (char*)malloc(MAX_PATH);
|
||||
size_t i;
|
||||
wcstombs_s(&i, lPr, (size_t)MAX_PATH,
|
||||
legacyUserProfilePath, (size_t)MAX_PATH);
|
||||
@ -240,8 +243,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd");
|
||||
|
||||
char *lPr = (char *)malloc(MAX_PATH);
|
||||
char *pR = (char *)malloc(MAX_PATH);
|
||||
char* lPr = (char*)malloc(MAX_PATH);
|
||||
char* pR = (char*)malloc(MAX_PATH);
|
||||
size_t i;
|
||||
wcstombs_s(&i, lPr, (size_t)MAX_PATH,
|
||||
legacyUserAliasesPath, (size_t)MAX_PATH);
|
||||
@ -251,27 +254,54 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
}
|
||||
}
|
||||
|
||||
// Set path to vendored ConEmu config file
|
||||
PathCombine(cfgPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.xml");
|
||||
PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal");
|
||||
PathCombine(conEmuDir, exeDir, L"vendor\\conemu-maximus5");
|
||||
|
||||
// Set path to Cmder default ConEmu config file
|
||||
PathCombine(defaultCfgPath, exeDir, L"vendor\\ConEmu.xml.default");
|
||||
if (PathFileExists(windowsTerminalDir))
|
||||
{
|
||||
// Set path to vendored ConEmu config file
|
||||
PathCombine(cfgPath, windowsTerminalDir, L"settings\\settings.json");
|
||||
|
||||
// Check for machine-specific then user config source file.
|
||||
PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml");
|
||||
ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0]));
|
||||
// Set path to Cmder default ConEmu config file
|
||||
PathCombine(defaultCfgPath, exeDir, L"vendor\\windows_terminal_default_settings.json");
|
||||
|
||||
// Set path to Cmder user ConEmu config file
|
||||
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
// Check for machine-specific then user config source file.
|
||||
PathCombine(cpuCfgPath, userConfigDirPath, L"windows_terminal_%COMPUTERNAME%_settings.json");
|
||||
ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0]));
|
||||
|
||||
if ( PathFileExists(cpuCfgPath) || use_user_cfg == false ) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config.
|
||||
// Set path to Cmder user ConEmu config file
|
||||
PathCombine(userCfgPath, userConfigDirPath, L"user_windows_terminal_settings.json");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set path to vendored ConEmu config file
|
||||
PathCombine(cfgPath, conEmuDir, L"ConEmu.xml");
|
||||
|
||||
// Set path to Cmder default ConEmu config file
|
||||
PathCombine(defaultCfgPath, exeDir, L"vendor\\ConEmu.xml.default");
|
||||
|
||||
// Check for machine-specific then user config source file.
|
||||
PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml");
|
||||
ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0]));
|
||||
|
||||
// Set path to Cmder user ConEmu config file
|
||||
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
}
|
||||
|
||||
if (PathFileExists(cpuCfgPath) || use_user_cfg == false) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config.
|
||||
{
|
||||
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||
{
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||
{
|
||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||
{
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_terminal_%COMPUTERNAME%_settings.json! Access Denied."
|
||||
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_%COMPUTERNAME%_settigns.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||
@ -279,10 +309,19 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
|
||||
}
|
||||
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
|
||||
{
|
||||
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied."
|
||||
: L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
@ -291,23 +330,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
}
|
||||
}
|
||||
}
|
||||
else // '/c [path]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu.
|
||||
{
|
||||
if (use_user_cfg == false && PathFileExists(cfgPath) && !PathFileExists(cpuCfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||
{
|
||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml");
|
||||
ExpandEnvironmentStrings(userConEmuCfgPath, userConEmuCfgPath, sizeof(userConEmuCfgPath) / sizeof(userConEmuCfgPath[0]));
|
||||
}
|
||||
}
|
||||
else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it.
|
||||
{
|
||||
@ -317,27 +339,46 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_terminal_settings.json! Access Denied."
|
||||
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_settigns.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
|
||||
{
|
||||
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy config/user_windows_terminal_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied."
|
||||
: L"Failed to copy config/user_windows_terminal_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // '/c [path]' was specified, don't copy anything and use existing user_conemu.xml to start comemu.
|
||||
{
|
||||
else if (!PathFileExists(windowsTerminalDir)) { // '/c [path]' was specified, don't copy anything and use existing user_conemu.xml to start comemu.
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
}
|
||||
}
|
||||
@ -347,21 +388,41 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settings.json! Access Denied."
|
||||
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settigns.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml.
|
||||
{
|
||||
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied."
|
||||
: L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to vendor/windows-terminal/settings/settigns.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -380,11 +441,21 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settings_settings.json! Access Denied."
|
||||
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/user_windows_terminal_settings_settigns.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
@ -393,51 +464,74 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
{
|
||||
if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to [user specified path]/config/user_windows_terminal_settings.json! Access Denied."
|
||||
: L"Failed to copy vendor/windows-terminal_default_settings_settings.json file to [user specified path]/config/user_windows_terminal_settings.json!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
}
|
||||
|
||||
SYSTEM_INFO sysInfo;
|
||||
GetNativeSystemInfo(&sysInfo);
|
||||
if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
||||
{
|
||||
PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe");
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
PathCombine(terminalPath, exeDir, L"vendor\\windows-terminal\\WindowsTerminal.exe");
|
||||
}
|
||||
else
|
||||
{
|
||||
PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe");
|
||||
PathCombine(terminalPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe");
|
||||
}
|
||||
|
||||
swprintf_s(args, L"%s /Icon \"%s\"", args, icoPath);
|
||||
if (!PathFileExists(windowsTerminalDir)) {
|
||||
swprintf_s(args, L"%s /Icon \"%s\"", args, icoPath);
|
||||
}
|
||||
|
||||
if (!streqi(cmderStart.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"%s /dir \"%s\"", args, cmderStart.c_str());
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
swprintf_s(args, L"%s -d \"%s\"", args, cmderStart.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(args, L"%s /dir \"%s\"", args, cmderStart.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (is_single_mode)
|
||||
{
|
||||
swprintf_s(args, L"%s /single", args);
|
||||
if (!PathFileExists(windowsTerminalDir)) {
|
||||
swprintf_s(args, L"%s /single", args);
|
||||
}
|
||||
}
|
||||
|
||||
if (!streqi(cmderTitle.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str());
|
||||
if (!PathFileExists(windowsTerminalDir)) {
|
||||
swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (cfgRoot.length() != 0)
|
||||
{
|
||||
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
||||
if (!PathFileExists(windowsTerminalDir)) {
|
||||
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (!streqi(cmderConEmuArgs.c_str(), L""))
|
||||
if (!streqi(cmderTerminalArgs.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"%s %s", args, cmderConEmuArgs.c_str());
|
||||
swprintf_s(args, L"%s %s", args, cmderTerminalArgs.c_str());
|
||||
}
|
||||
|
||||
// The `/run` arg and its value MUST be the last arg of ConEmu
|
||||
@ -445,7 +539,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
// > This must be the last used switch (excepting -new_console and -cur_console)
|
||||
if (!streqi(cmderTask.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str());
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
swprintf_s(args, L"%s -p \"%s\"", args, cmderTask.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
||||
@ -465,8 +565,14 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
si.dwFlags = STARTF_TITLEISAPPID;
|
||||
#endif
|
||||
PROCESS_INFORMATION pi;
|
||||
if (!CreateProcess(conEmuPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) {
|
||||
MessageBox(NULL, _T("Unable to create the ConEmu process!"), _T("Error"), MB_OK);
|
||||
if (!CreateProcess(terminalPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) {
|
||||
if (PathFileExists(windowsTerminalDir)) {
|
||||
MessageBox(NULL, _T("Unable to create the Windows Terminal process!"), _T("Error"), MB_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, _T("Unable to create the ConEmu process!"), _T("Error"), MB_OK);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -521,11 +627,11 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgR
|
||||
|
||||
wchar_t commandStr[MAX_PATH + 20] = { 0 };
|
||||
wchar_t baseCommandStr[MAX_PATH + 20] = { 0 };
|
||||
if (!single) {
|
||||
swprintf_s(baseCommandStr, L"\"%s\"", exePath);
|
||||
if (single) {
|
||||
swprintf_s(baseCommandStr, L"\"%s\" /single", exePath);
|
||||
}
|
||||
else {
|
||||
swprintf_s(baseCommandStr, L"\"%s\" /single", exePath);
|
||||
swprintf_s(baseCommandStr, L"\"%s\"", exePath);
|
||||
}
|
||||
|
||||
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||
@ -583,7 +689,7 @@ struct cmderOptions
|
||||
std::wstring cmderTitle = L"Cmder";
|
||||
std::wstring cmderIcon = L"";
|
||||
std::wstring cmderRegScope = L"USER";
|
||||
std::wstring cmderConEmuArgs = L"";
|
||||
std::wstring cmderTerminalArgs = L"";
|
||||
bool cmderSingle = false;
|
||||
bool cmderUserCfg = true;
|
||||
bool registerApp = false;
|
||||
@ -597,6 +703,14 @@ cmderOptions GetOption()
|
||||
LPWSTR *szArgList;
|
||||
int argCount;
|
||||
|
||||
wchar_t windowsTerminalDir[MAX_PATH] = { 0 };
|
||||
wchar_t exeDir[MAX_PATH] = { 0 };
|
||||
|
||||
GetModuleFileName(NULL, exeDir, sizeof(exeDir));
|
||||
PathRemoveFileSpec(exeDir);
|
||||
|
||||
PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal");
|
||||
|
||||
szArgList = CommandLineToArgvW(GetCommandLine(), &argCount);
|
||||
|
||||
for (int i = 1; i < argCount; i++)
|
||||
@ -643,21 +757,21 @@ cmderOptions GetOption()
|
||||
cmderOptions.cmderTask = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else if (_wcsicmp(L"/title", szArgList[i]) == 0)
|
||||
else if (_wcsicmp(L"/title", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir))
|
||||
{
|
||||
cmderOptions.cmderTitle = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else if (_wcsicmp(L"/icon", szArgList[i]) == 0)
|
||||
else if (_wcsicmp(L"/icon", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir))
|
||||
{
|
||||
cmderOptions.cmderIcon = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else if (_wcsicmp(L"/single", szArgList[i]) == 0)
|
||||
else if (_wcsicmp(L"/single", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir))
|
||||
{
|
||||
cmderOptions.cmderSingle = true;
|
||||
}
|
||||
else if (_wcsicmp(L"/m", szArgList[i]) == 0)
|
||||
else if (_wcsicmp(L"/m", szArgList[i]) == 0 && !PathFileExists(windowsTerminalDir))
|
||||
{
|
||||
cmderOptions.cmderUserCfg = false;
|
||||
}
|
||||
@ -690,7 +804,7 @@ cmderOptions GetOption()
|
||||
/* Used for passing arguments to conemu prog */
|
||||
else if (_wcsicmp(L"/x", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.cmderConEmuArgs = szArgList[i + 1];
|
||||
cmderOptions.cmderTerminalArgs = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
/* Bare double dash, remaining commandline is for conemu */
|
||||
@ -700,7 +814,7 @@ cmderOptions GetOption()
|
||||
auto doubledash = cmdline.find(L" -- ");
|
||||
if (doubledash != std::string::npos)
|
||||
{
|
||||
cmderOptions.cmderConEmuArgs = cmdline.substr(doubledash + 4);
|
||||
cmderOptions.cmderTerminalArgs = cmdline.substr(doubledash + 4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -756,12 +870,30 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
cmderOptions cmderOptions = GetOption();
|
||||
|
||||
wchar_t windowsTerminalDir[MAX_PATH] = { 0 };
|
||||
wchar_t exeDir[MAX_PATH] = { 0 };
|
||||
|
||||
GetModuleFileName(NULL, exeDir, sizeof(exeDir));
|
||||
PathRemoveFileSpec(exeDir);
|
||||
|
||||
PathCombine(windowsTerminalDir, exeDir, L"vendor\\windows-terminal");
|
||||
|
||||
if (cmderOptions.registerApp == true)
|
||||
{
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
if (PathFileExists(windowsTerminalDir))
|
||||
{
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
}
|
||||
else
|
||||
{
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, false);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, false);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, false);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, false);
|
||||
}
|
||||
}
|
||||
else if (cmderOptions.unRegisterApp == true)
|
||||
{
|
||||
@ -776,7 +908,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs);
|
||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderTerminalArgs);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -6,7 +6,7 @@ STRINGTABLE
|
||||
{
|
||||
IDS_TITLE "Cmder Launcher"
|
||||
|
||||
IDS_SWITCHES L"Valid options:\n\n /c [CMDER User Root Path]\n /task [ConEmu Task Name]\n /icon [CMDER Icon Path]\n [/start [Start in Path] | [Start in Path]]\n /single\n /m\n -- [ConEmu extra arguments]\n\nNote: '-- [...]' must be the last argument!\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]"
|
||||
IDS_SWITCHES L"Valid options:\n\n /c [CMDER User Root Path]\n /task [Windows Terminal Profile/ConEmu Task Name]\n /icon [CMDER Icon Path] - ConEmu ONLY!\n [/start [Start in Path] | [Start in Path]]\n /single - ConEmu ONLY!\n /m\n -- [ConEmu/Windows Terminal extra arguments]\n\nNote: '-- [...]' must be the last argument!\n\nor, either:\n /register [USER | ALL]\n /unregister [USER | ALL]"
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -23,5 +23,6 @@ appveyor.yml
|
||||
vendor\cmder.sh
|
||||
vendor\git-prompt.sh
|
||||
config\user-*
|
||||
config\user_*
|
||||
clink_history*
|
||||
*.log
|
||||
|
@ -55,13 +55,16 @@ Param(
|
||||
|
||||
# Using this option will skip all downloads, if you only need to build launcher
|
||||
[switch]$noVendor,
|
||||
|
||||
# Using this option will specify the emulator to use [all, conemu-maximus5, or windows-terminal]
|
||||
[string]$emulator = 'all',
|
||||
|
||||
# Build launcher if you have MSBuild tools installed
|
||||
[switch]$Compile
|
||||
)
|
||||
|
||||
# Get the scripts and cmder root dirs we are building in.
|
||||
$cmder_root = Resolve-Path "$PSScriptRoot\.."
|
||||
$cmder_root = [string](Resolve-Path "$PSScriptRoot\..")
|
||||
|
||||
# Dot source util functions into this scope
|
||||
. "$PSScriptRoot\utils.ps1"
|
||||
@ -113,6 +116,18 @@ if (-not $noVendor) {
|
||||
}
|
||||
else { $ConEmuXml = "" }
|
||||
|
||||
# Preserve modified (by user) Windows Terminal setting file
|
||||
if ($config -ne "") {
|
||||
$WinTermSettingsJson = Join-Path $saveTo "windows-terminal\settings\settings.json"
|
||||
if (Test-Path $WinTermSettingsJson -pathType leaf) {
|
||||
$WinTermSettingsJsonSave = Join-Path $config "windows_terminal_settings.json"
|
||||
Write-Verbose "Backup '$WinTermSettingsJson' to '$WinTermSettingsJsonSave'"
|
||||
Copy-Item $WinTermSettingsJson $WinTermSettingsJsonSave
|
||||
}
|
||||
else { $WinTermSettingsJson = "" }
|
||||
}
|
||||
else { $WinTermSettingsJson = "" }
|
||||
|
||||
# Kill ssh-agent.exe if it is running from the $env:cmder_root we are building
|
||||
foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) {
|
||||
if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\', '\\')) {
|
||||
@ -122,6 +137,12 @@ if (-not $noVendor) {
|
||||
}
|
||||
|
||||
foreach ($s in $sources) {
|
||||
if ($s.name -eq "conemu-maximus5" -and $emulator -eq "windows-terminal") {
|
||||
return
|
||||
} elseif ($s.name -eq "windows-terminal" -and $emulator -eq "conemu-maximus5") {
|
||||
return
|
||||
}
|
||||
|
||||
Write-Verbose "Getting vendored $($s.name) $($s.version)..."
|
||||
|
||||
# We do not care about the extensions/type of archive
|
||||
@ -132,6 +153,16 @@ if (-not $noVendor) {
|
||||
Download-File -Url $s.url -File $vend\$tempArchive -ErrorAction Stop
|
||||
Extract-Archive $tempArchive $s.name
|
||||
|
||||
# Make Embedded Windows Terminal Portable
|
||||
if ($s.name -eq "windows-terminal") {
|
||||
$windowTerminalFiles = resolve-path ($saveTo + "\" + $s.name + "\terminal*")
|
||||
move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null
|
||||
remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null
|
||||
write-verbose "Making Windows Terminal Portable..."
|
||||
New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null
|
||||
New-Item -Type File -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null
|
||||
}
|
||||
|
||||
if ((Get-ChildItem $s.name).Count -eq 1) {
|
||||
Flatten-Directory($s.name)
|
||||
}
|
||||
@ -146,6 +177,12 @@ if (-not $noVendor) {
|
||||
Copy-Item $ConEmuXmlSave $ConEmuXml
|
||||
}
|
||||
|
||||
# Restore Windows Terminal user configuration
|
||||
if ($WinTermSettingsJson -ne "") {
|
||||
Write-Verbose "Restore '$WinTermSettingsJsonSave' to '$WinTermSettingsJson'"
|
||||
Copy-Item $WinTermSettingsJsonSave $WinTermSettingsJson
|
||||
}
|
||||
|
||||
# Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty
|
||||
if ( (Test-Path $($saveTo + "git-for-windows/etc/profile.d") ) ) {
|
||||
Write-Verbose "Adding cmder.sh /etc/profile.d"
|
||||
|
@ -31,6 +31,9 @@ Param(
|
||||
# Path to the vendor configuration source file
|
||||
[string]$cmderRoot = "$PSScriptRoot\..",
|
||||
|
||||
# Using this option will pack artifacts for a specific included terminal emulator [all, conemu-maximus5, or windows-terminal]
|
||||
[string]$emulator = 'all',
|
||||
|
||||
# Vendor folder locaton
|
||||
[string]$saveTo = "$PSScriptRoot\..\build"
|
||||
)
|
||||
@ -41,10 +44,27 @@ $cmderRoot = Resolve-Path $cmderRoot
|
||||
$ErrorActionPreference = "Stop"
|
||||
Ensure-Executable "7z"
|
||||
|
||||
$targets = @{
|
||||
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on";
|
||||
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3";
|
||||
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`"";
|
||||
if ($emulator -eq "windows-terminal") {
|
||||
$targets = @{
|
||||
"cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`"";
|
||||
"cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`"";
|
||||
"cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`"";
|
||||
}
|
||||
} elseif ($emulator -eq "windows-terminal") {
|
||||
$targets = @{
|
||||
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`"";
|
||||
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`"";
|
||||
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\windows-terminal`"";
|
||||
}
|
||||
} else {
|
||||
$targets = @{
|
||||
"cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`"";
|
||||
"cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`"";
|
||||
"cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`"";
|
||||
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`"";
|
||||
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`"";
|
||||
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\windows-terminal`"";
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location -Path $cmderRoot
|
||||
|
6
vendor/cmder.sh
vendored
6
vendor/cmder.sh
vendored
@ -22,7 +22,11 @@ function runProfiled {
|
||||
}
|
||||
|
||||
# We do this for bash as admin sessions since $CMDER_ROOT is not being set
|
||||
if [ "$CMDER_ROOT" == "" ] ; then
|
||||
if [ -z "$CMDER_ROOT" ] && [ -n "$cmder_root" ] ; then
|
||||
export CMDER_ROOT=$(cygpath -u $cmder_root)
|
||||
fi
|
||||
|
||||
if [ -z "$CMDER_ROOT" ] ; then
|
||||
case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac
|
||||
else
|
||||
case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac
|
||||
|
4
vendor/cmder_exinit
vendored
4
vendor/cmder_exinit
vendored
@ -43,6 +43,10 @@ function runProfiled {
|
||||
# Check that we haven't already been sourced.
|
||||
[[ -z ${CMDER_EXINIT} ]] && CMDER_EXINIT="1" || return
|
||||
|
||||
if [ -z "$CMDER_ROOT" ] && [ -n "$cmder_root" ] ; then
|
||||
export CMDER_ROOT=$(cygpath -u $cmder_root)
|
||||
fi
|
||||
|
||||
# We do this for bash as admin sessions since $CMDER_ROOT is not being set
|
||||
if [ "$CMDER_ROOT" = "" -a "$ConEmuDir" != "" ] ; then
|
||||
if [ -d "${ConEmuDir}/../../vendor" ] ; then
|
||||
|
5
vendor/sources.json
vendored
5
vendor/sources.json
vendored
@ -1,4 +1,9 @@
|
||||
[
|
||||
{
|
||||
"name": "windows-terminal",
|
||||
"version": "1.17.11461.0",
|
||||
"url": "https://github.com/microsoft/terminal/releases/download/v1.17.11461.0/Microsoft.WindowsTerminal_1.17.11461.0_x64.zip"
|
||||
},
|
||||
{
|
||||
"name": "git-for-windows",
|
||||
"version": "2.42.0.windows.1",
|
||||
|
388
vendor/windows_terminal_default_settings.json
vendored
Normal file
388
vendor/windows_terminal_default_settings.json
vendored
Normal file
@ -0,0 +1,388 @@
|
||||
{
|
||||
"$help": "https://aka.ms/terminal-documentation",
|
||||
"$schema": "https://aka.ms/terminal-profiles-schema",
|
||||
"actions":
|
||||
[
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "copy",
|
||||
"singleLine": false
|
||||
},
|
||||
"keys": "ctrl+shift+c"
|
||||
},
|
||||
{
|
||||
"command": "paste"
|
||||
},
|
||||
{
|
||||
"command": "find",
|
||||
"keys": "ctrl+shift+f"
|
||||
},
|
||||
{
|
||||
"command": "unbound",
|
||||
"keys": "ctrl+v"
|
||||
},
|
||||
{
|
||||
"command": "unbound",
|
||||
"keys": "ctrl+c"
|
||||
},
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"action": "splitPane",
|
||||
"split": "auto",
|
||||
"splitMode": "duplicate"
|
||||
},
|
||||
"keys": "alt+shift+d"
|
||||
}
|
||||
],
|
||||
"copyFormatting": "none",
|
||||
"copyOnSelect": true,
|
||||
"defaultProfile": "{48946353-ebe8-4571-a591-7d609f31327a}",
|
||||
"newTabMenu":
|
||||
[
|
||||
{
|
||||
"type": "remainingProfiles"
|
||||
}
|
||||
],
|
||||
"profiles":
|
||||
{
|
||||
"defaults": {},
|
||||
"list":
|
||||
[
|
||||
{
|
||||
"colorScheme": "Campbell",
|
||||
"commandline": "cmd /k \"%CMDER_ROOT%\\vendor\\init.bat\"",
|
||||
"guid": "{48946353-ebe8-4571-a591-7d609f31327a}",
|
||||
"hidden": false,
|
||||
"icon": "%CMDER_ROOT%\\icons\\cmder.ico",
|
||||
"name": "Cmder",
|
||||
"startingDirectory": "",
|
||||
"tabTitle": "Cmder",
|
||||
"useAtlasEngine": false
|
||||
},
|
||||
{
|
||||
"commandline": "%SystemRoot%\\System32\\cmd.exe /k \"%CMDER_ROOT%\\vendor\\init.bat\"",
|
||||
"elevate": true,
|
||||
"guid": "{bdd957d0-c15a-49e6-9816-14b02351a071}",
|
||||
"hidden": false,
|
||||
"icon": "%CMDER_ROOT%\\icons\\cmder_red.ico",
|
||||
"name": "Cmder as Admin",
|
||||
"startingDirectory": "",
|
||||
"tabTitle": "Cmder as Admin"
|
||||
},
|
||||
{
|
||||
"colorScheme": "Campbell",
|
||||
"commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%CMDER_ROOT%\\vendor.\\profile.ps1'''\"",
|
||||
"guid": "{eb1f6578-ce9d-47a9-a8c7-9b3fdd22302d}",
|
||||
"hidden": false,
|
||||
"icon": "%CMDER_ROOT%\\icons\\cmder_orange.ico",
|
||||
"name": "Cmder - PowerShell",
|
||||
"startingDirectory": "",
|
||||
"tabTitle": "Cmder",
|
||||
"useAtlasEngine": false
|
||||
},
|
||||
{
|
||||
"colorScheme": "Campbell",
|
||||
"commandline": "PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression 'Import-Module ''%CMDER_ROOT%\\vendor.\\profile.ps1'''\"",
|
||||
"elevate": true,
|
||||
"guid": "{c5225c3e-8619-4145-8182-2800814eeb17}",
|
||||
"hidden": false,
|
||||
"icon": "%CMDER_ROOT%\\icons\\cmder_purple.ico",
|
||||
"name": "Cmder - PowerShell as Admin",
|
||||
"startingDirectory": "",
|
||||
"tabTitle": "Cmder - PowerShell as Admin",
|
||||
"useAtlasEngine": false
|
||||
},
|
||||
{
|
||||
"commandline": "%CMDER_ROOT%\\vendor\\start_git_bash.cmd",
|
||||
"guid": "{c5c298e9-010e-4b8c-bc55-e3df81846b4c}",
|
||||
"hidden": false,
|
||||
"icon": "%CMDER_ROOT%\\icons\\cmder_blue.ico",
|
||||
"name": "Cmder - Bash",
|
||||
"startingDirectory": "",
|
||||
"tabTitle": "Cmder - Bash"
|
||||
},
|
||||
{
|
||||
"commandline": "%CMDER_ROOT%\\vendor\\start_git_bash.cmd",
|
||||
"elevate": true,
|
||||
"guid": "{545eb9ed-4c1c-49b3-8cc6-7eb41bd280ff}",
|
||||
"hidden": false,
|
||||
"icon": "%CMDER_ROOT%\\icons\\cmder_yellow.ico",
|
||||
"name": "Cmder - Bash as Admin",
|
||||
"startingDirectory": "",
|
||||
"tabTitle": "Cmder - Bash as Admin"
|
||||
},
|
||||
{
|
||||
"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
||||
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
|
||||
"hidden": false,
|
||||
"name": "Windows PowerShell"
|
||||
},
|
||||
{
|
||||
"commandline": "%SystemRoot%\\System32\\cmd.exe",
|
||||
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
|
||||
"hidden": false,
|
||||
"name": "Command Prompt"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
"schemes":
|
||||
[
|
||||
{
|
||||
"background": "#0C0C0C",
|
||||
"black": "#0C0C0C",
|
||||
"blue": "#0037DA",
|
||||
"brightBlack": "#767676",
|
||||
"brightBlue": "#3B78FF",
|
||||
"brightCyan": "#61D6D6",
|
||||
"brightGreen": "#16C60C",
|
||||
"brightPurple": "#B4009E",
|
||||
"brightRed": "#E74856",
|
||||
"brightWhite": "#F2F2F2",
|
||||
"brightYellow": "#F9F1A5",
|
||||
"cursorColor": "#FFFFFF",
|
||||
"cyan": "#3A96DD",
|
||||
"foreground": "#CCCCCC",
|
||||
"green": "#13A10E",
|
||||
"name": "Campbell",
|
||||
"purple": "#881798",
|
||||
"red": "#C50F1F",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#CCCCCC",
|
||||
"yellow": "#C19C00"
|
||||
},
|
||||
{
|
||||
"background": "#012456",
|
||||
"black": "#0C0C0C",
|
||||
"blue": "#0037DA",
|
||||
"brightBlack": "#767676",
|
||||
"brightBlue": "#3B78FF",
|
||||
"brightCyan": "#61D6D6",
|
||||
"brightGreen": "#16C60C",
|
||||
"brightPurple": "#B4009E",
|
||||
"brightRed": "#E74856",
|
||||
"brightWhite": "#F2F2F2",
|
||||
"brightYellow": "#F9F1A5",
|
||||
"cursorColor": "#FFFFFF",
|
||||
"cyan": "#3A96DD",
|
||||
"foreground": "#CCCCCC",
|
||||
"green": "#13A10E",
|
||||
"name": "Campbell Powershell",
|
||||
"purple": "#881798",
|
||||
"red": "#C50F1F",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#CCCCCC",
|
||||
"yellow": "#C19C00"
|
||||
},
|
||||
{
|
||||
"background": "#282C34",
|
||||
"black": "#282C34",
|
||||
"blue": "#61AFEF",
|
||||
"brightBlack": "#5A6374",
|
||||
"brightBlue": "#61AFEF",
|
||||
"brightCyan": "#56B6C2",
|
||||
"brightGreen": "#98C379",
|
||||
"brightPurple": "#C678DD",
|
||||
"brightRed": "#E06C75",
|
||||
"brightWhite": "#DCDFE4",
|
||||
"brightYellow": "#E5C07B",
|
||||
"cursorColor": "#FFFFFF",
|
||||
"cyan": "#56B6C2",
|
||||
"foreground": "#DCDFE4",
|
||||
"green": "#98C379",
|
||||
"name": "One Half Dark",
|
||||
"purple": "#C678DD",
|
||||
"red": "#E06C75",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#DCDFE4",
|
||||
"yellow": "#E5C07B"
|
||||
},
|
||||
{
|
||||
"background": "#FAFAFA",
|
||||
"black": "#383A42",
|
||||
"blue": "#0184BC",
|
||||
"brightBlack": "#4F525D",
|
||||
"brightBlue": "#61AFEF",
|
||||
"brightCyan": "#56B5C1",
|
||||
"brightGreen": "#98C379",
|
||||
"brightPurple": "#C577DD",
|
||||
"brightRed": "#DF6C75",
|
||||
"brightWhite": "#FFFFFF",
|
||||
"brightYellow": "#E4C07A",
|
||||
"cursorColor": "#4F525D",
|
||||
"cyan": "#0997B3",
|
||||
"foreground": "#383A42",
|
||||
"green": "#50A14F",
|
||||
"name": "One Half Light",
|
||||
"purple": "#A626A4",
|
||||
"red": "#E45649",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#FAFAFA",
|
||||
"yellow": "#C18301"
|
||||
},
|
||||
{
|
||||
"background": "#002B36",
|
||||
"black": "#002B36",
|
||||
"blue": "#268BD2",
|
||||
"brightBlack": "#073642",
|
||||
"brightBlue": "#839496",
|
||||
"brightCyan": "#93A1A1",
|
||||
"brightGreen": "#586E75",
|
||||
"brightPurple": "#6C71C4",
|
||||
"brightRed": "#CB4B16",
|
||||
"brightWhite": "#FDF6E3",
|
||||
"brightYellow": "#657B83",
|
||||
"cursorColor": "#FFFFFF",
|
||||
"cyan": "#2AA198",
|
||||
"foreground": "#839496",
|
||||
"green": "#859900",
|
||||
"name": "Solarized Dark",
|
||||
"purple": "#D33682",
|
||||
"red": "#DC322F",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#EEE8D5",
|
||||
"yellow": "#B58900"
|
||||
},
|
||||
{
|
||||
"background": "#FDF6E3",
|
||||
"black": "#002B36",
|
||||
"blue": "#268BD2",
|
||||
"brightBlack": "#073642",
|
||||
"brightBlue": "#839496",
|
||||
"brightCyan": "#93A1A1",
|
||||
"brightGreen": "#586E75",
|
||||
"brightPurple": "#6C71C4",
|
||||
"brightRed": "#CB4B16",
|
||||
"brightWhite": "#FDF6E3",
|
||||
"brightYellow": "#657B83",
|
||||
"cursorColor": "#002B36",
|
||||
"cyan": "#2AA198",
|
||||
"foreground": "#657B83",
|
||||
"green": "#859900",
|
||||
"name": "Solarized Light",
|
||||
"purple": "#D33682",
|
||||
"red": "#DC322F",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#EEE8D5",
|
||||
"yellow": "#B58900"
|
||||
},
|
||||
{
|
||||
"background": "#000000",
|
||||
"black": "#000000",
|
||||
"blue": "#3465A4",
|
||||
"brightBlack": "#555753",
|
||||
"brightBlue": "#729FCF",
|
||||
"brightCyan": "#34E2E2",
|
||||
"brightGreen": "#8AE234",
|
||||
"brightPurple": "#AD7FA8",
|
||||
"brightRed": "#EF2929",
|
||||
"brightWhite": "#EEEEEC",
|
||||
"brightYellow": "#FCE94F",
|
||||
"cursorColor": "#FFFFFF",
|
||||
"cyan": "#06989A",
|
||||
"foreground": "#D3D7CF",
|
||||
"green": "#4E9A06",
|
||||
"name": "Tango Dark",
|
||||
"purple": "#75507B",
|
||||
"red": "#CC0000",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#D3D7CF",
|
||||
"yellow": "#C4A000"
|
||||
},
|
||||
{
|
||||
"background": "#FFFFFF",
|
||||
"black": "#000000",
|
||||
"blue": "#3465A4",
|
||||
"brightBlack": "#555753",
|
||||
"brightBlue": "#729FCF",
|
||||
"brightCyan": "#34E2E2",
|
||||
"brightGreen": "#8AE234",
|
||||
"brightPurple": "#AD7FA8",
|
||||
"brightRed": "#EF2929",
|
||||
"brightWhite": "#EEEEEC",
|
||||
"brightYellow": "#FCE94F",
|
||||
"cursorColor": "#000000",
|
||||
"cyan": "#06989A",
|
||||
"foreground": "#555753",
|
||||
"green": "#4E9A06",
|
||||
"name": "Tango Light",
|
||||
"purple": "#75507B",
|
||||
"red": "#CC0000",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#D3D7CF",
|
||||
"yellow": "#C4A000"
|
||||
},
|
||||
{
|
||||
"background": "#000000",
|
||||
"black": "#000000",
|
||||
"blue": "#000080",
|
||||
"brightBlack": "#808080",
|
||||
"brightBlue": "#0000FF",
|
||||
"brightCyan": "#00FFFF",
|
||||
"brightGreen": "#00FF00",
|
||||
"brightPurple": "#FF00FF",
|
||||
"brightRed": "#FF0000",
|
||||
"brightWhite": "#FFFFFF",
|
||||
"brightYellow": "#FFFF00",
|
||||
"cursorColor": "#FFFFFF",
|
||||
"cyan": "#008080",
|
||||
"foreground": "#C0C0C0",
|
||||
"green": "#008000",
|
||||
"name": "Vintage",
|
||||
"purple": "#800080",
|
||||
"red": "#800000",
|
||||
"selectionBackground": "#FFFFFF",
|
||||
"white": "#C0C0C0",
|
||||
"yellow": "#808000"
|
||||
}
|
||||
],
|
||||
"themes":
|
||||
[
|
||||
{
|
||||
"name": "legacyDark",
|
||||
"tab":
|
||||
{
|
||||
"background": null,
|
||||
"showCloseButton": "always",
|
||||
"unfocusedBackground": null
|
||||
},
|
||||
"window":
|
||||
{
|
||||
"applicationTheme": "dark",
|
||||
"useMica": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "legacyLight",
|
||||
"tab":
|
||||
{
|
||||
"background": null,
|
||||
"showCloseButton": "always",
|
||||
"unfocusedBackground": null
|
||||
},
|
||||
"window":
|
||||
{
|
||||
"applicationTheme": "light",
|
||||
"useMica": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "legacySystem",
|
||||
"tab":
|
||||
{
|
||||
"background": null,
|
||||
"showCloseButton": "always",
|
||||
"unfocusedBackground": null
|
||||
},
|
||||
"window":
|
||||
{
|
||||
"applicationTheme": "system",
|
||||
"useMica": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"useAcrylicInTabRow": true,
|
||||
"wordDelimiters": " ()\"',;<>!@#$%^&*|+=[]{}~?\u2502"
|
||||
}
|
Loading…
Reference in New Issue
Block a user