diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 86ba8f3..f1f2734 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -71,7 +71,7 @@ bool FileExists(const wchar_t * filePath) return false; } -void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"") +void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring title = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"") { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -98,6 +98,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr std::wstring cmderStart = path; std::wstring cmderTask = taskName; + std::wstring cmderTitle = title; std::wstring cmderConEmuArgs = conemu_args; std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath); @@ -370,7 +371,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); } - swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder", args, icoPath); + swprintf_s(args, L"%s /Icon \"%s\"", args, icoPath); if (!streqi(cmderStart.c_str(), L"")) { @@ -387,6 +388,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str()); } + if (!streqi(cmderTitle.c_str(), L"")) + { + swprintf_s(args, L"%s /title \"%s\"", args, cmderTitle.c_str()); + } + if (cfgRoot.length() != 0) { swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath); @@ -532,6 +538,7 @@ struct cmderOptions std::wstring cmderCfgRoot = L""; std::wstring cmderStart = L""; std::wstring cmderTask = L""; + std::wstring cmderTitle = L"Cmder"; std::wstring cmderRegScope = L"USER"; std::wstring cmderConEmuArgs = L""; bool cmderSingle = false; @@ -593,6 +600,11 @@ cmderOptions GetOption() cmderOptions.cmderTask = szArgList[i + 1]; i++; } + else if (_wcsicmp(L"/title", szArgList[i]) == 0) + { + cmderOptions.cmderTitle = szArgList[i + 1]; + i++; + } else if (_wcsicmp(L"/single", szArgList[i]) == 0) { cmderOptions.cmderSingle = true; @@ -659,13 +671,13 @@ cmderOptions GetOption() } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n /title [ConEmu Title]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n /title [ConEmu Title]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } @@ -707,7 +719,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs); + StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs); } return 0;