From 0f295234cc95427ccef82bb23c5493d3abeb7a57 Mon Sep 17 00:00:00 2001 From: TheCjw Date: Thu, 4 Sep 2014 23:29:51 +0800 Subject: [PATCH 1/2] Adding single mode support. --- launcher/src/CmderLauncher.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index fcdeb60ec..c92bc4aa6 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -79,7 +79,7 @@ optpair GetOption() return pair; } -void StartCmder(std::wstring path) +void StartCmder(std::wstring path, bool is_single_mode) { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -102,7 +102,14 @@ void StartCmder(std::wstring path) PathCombine(cfgPath, exeDir, L"config\\ConEmu.xml"); PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); - swprintf_s(args, L"/Icon \"%s\" /Title Cmder /LoadCfgFile \"%s\"", icoPath, cfgPath); + if (is_single_mode) + { + swprintf_s(args, L"/single /Icon \"%s\" /Title Cmder /LoadCfgFile \"%s\"", icoPath, cfgPath); + } + else + { + swprintf_s(args, L"/Icon \"%s\" /Title Cmder /LoadCfgFile \"%s\"", icoPath, cfgPath); + } SetEnvironmentVariable(L"CMDER_ROOT", exeDir); SetEnvironmentVariable(L"CMDER_START", path.c_str()); @@ -229,7 +236,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, if (streqi(opt.first.c_str(), L"/START")) { - StartCmder(opt.second); + StartCmder(opt.second, false); + } + else if (streqi(opt.first.c_str(), L"/SINGLE")) + { + StartCmder(opt.second, true); } else if (streqi(opt.first.c_str(), L"/REGISTER")) { From 18fea0ac0375b912eb0b3fd7a9dff14893d50b92 Mon Sep 17 00:00:00 2001 From: TheCjw Date: Thu, 4 Sep 2014 23:41:39 +0800 Subject: [PATCH 2/2] Update prompt text --- launcher/src/CmderLauncher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index c92bc4aa6..893e33cdf 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -254,7 +254,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START \n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START \n /SINGLE \n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK); return 1; }