mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
Add FWPARS cmdline argument.
This argument forwards parameters to ConEmu app. e.g. Cmder.exe /FWPARS "-min -tsa" In this case Cmder will start minimized on TaskBar
This commit is contained in:
parent
865e443fcd
commit
5def1c584a
@ -50,6 +50,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
|
||||
| `/SINGLE` | Start Cmder in single mode. |
|
||||
| `/START [start_path]` | Folder path to start in. |
|
||||
| `/TASK [task_name]` | Task to start after launch. |
|
||||
| `/FWPARS [ConEmu params]` | Forwads parameters to ConEmu |
|
||||
|
||||
## Context Menu Integration
|
||||
|
||||
|
@ -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)
|
||||
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 pars2fw = 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 cmderPars2CEmu = pars2fw;
|
||||
|
||||
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
||||
userConfigDirPath[cfgRoot.length()] = 0;
|
||||
@ -391,6 +392,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
||||
}
|
||||
|
||||
if (!streqi(cmderPars2CEmu.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"%s %s", args, cmderPars2CEmu.c_str());
|
||||
}
|
||||
|
||||
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
||||
if (wcscmp(userConfigDirPath, configDirPath) != 0)
|
||||
{
|
||||
@ -527,6 +533,7 @@ struct cmderOptions
|
||||
std::wstring cmderStart = L"";
|
||||
std::wstring cmderTask = L"";
|
||||
std::wstring cmderRegScope = L"USER";
|
||||
std::wstring cmderPars2CEmu = L"";
|
||||
bool cmderSingle = false;
|
||||
bool cmderUserCfg = true;
|
||||
bool registerApp = false;
|
||||
@ -620,6 +627,11 @@ cmderOptions GetOption()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(L"/fwpars", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.cmderPars2CEmu = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else if (cmderOptions.cmderStart == L"")
|
||||
{
|
||||
int len = wcslen(szArgList[i]);
|
||||
@ -635,13 +647,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\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 [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\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\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 [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||
cmderOptions.error = true;
|
||||
}
|
||||
}
|
||||
@ -683,7 +695,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg);
|
||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderPars2CEmu);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user