Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5def1c5

Browse files
committed
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
1 parent 865e443 commit 5def1c5

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
5050
| `/SINGLE` | Start Cmder in single mode. |
5151
| `/START [start_path]` | Folder path to start in. |
5252
| `/TASK [task_name]` | Task to start after launch. |
53+
| `/FWPARS [ConEmu params]` | Forwads parameters to ConEmu |
5354
5455
## Context Menu Integration
5556

launcher/src/CmderLauncher.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ bool FileExists(const wchar_t * filePath)
7171
return false;
7272
}
7373

74-
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true)
74+
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"")
7575
{
7676
#if USE_TASKBAR_API
7777
wchar_t appId[MAX_PATH] = { 0 };
@@ -98,6 +98,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
9898

9999
std::wstring cmderStart = path;
100100
std::wstring cmderTask = taskName;
101+
std::wstring cmderPars2CEmu = pars2fw;
101102

102103
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
103104
userConfigDirPath[cfgRoot.length()] = 0;
@@ -391,6 +392,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
391392
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
392393
}
393394

395+
if (!streqi(cmderPars2CEmu.c_str(), L""))
396+
{
397+
swprintf_s(args, L"%s %s", args, cmderPars2CEmu.c_str());
398+
}
399+
394400
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
395401
if (wcscmp(userConfigDirPath, configDirPath) != 0)
396402
{
@@ -527,6 +533,7 @@ struct cmderOptions
527533
std::wstring cmderStart = L"";
528534
std::wstring cmderTask = L"";
529535
std::wstring cmderRegScope = L"USER";
536+
std::wstring cmderPars2CEmu = L"";
530537
bool cmderSingle = false;
531538
bool cmderUserCfg = true;
532539
bool registerApp = false;
@@ -620,6 +627,11 @@ cmderOptions GetOption()
620627
}
621628
}
622629
}
630+
else if (_wcsicmp(L"/fwpars", szArgList[i]) == 0)
631+
{
632+
cmderOptions.cmderPars2CEmu = szArgList[i + 1];
633+
i++;
634+
}
623635
else if (cmderOptions.cmderStart == L"")
624636
{
625637
int len = wcslen(szArgList[i]);
@@ -635,13 +647,13 @@ cmderOptions GetOption()
635647
}
636648
else
637649
{
638-
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);
650+
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);
639651
cmderOptions.error = true;
640652
}
641653
}
642654
else
643655
{
644-
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);
656+
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);
645657
cmderOptions.error = true;
646658
}
647659
}
@@ -683,7 +695,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
683695
}
684696
else
685697
{
686-
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg);
698+
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderPars2CEmu);
687699
}
688700

689701
return 0;

0 commit comments

Comments
 (0)