mirror of
https://github.com/cmderdev/cmder.git
synced 2025-03-15 07:04:39 +08:00
allow custom titles for the launcher
Custom option for launcher title
This commit is contained in:
commit
e8d34e07a1
@ -22,6 +22,7 @@
|
|||||||
<ProjectGuid>{4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}</ProjectGuid>
|
<ProjectGuid>{4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>CmderLauncher</RootNamespace>
|
<RootNamespace>CmderLauncher</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
@ -105,7 +105,7 @@ bool FileExists(const wchar_t * filePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring iconPath = 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 iconPath = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"")
|
||||||
{
|
{
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
wchar_t appId[MAX_PATH] = { 0 };
|
wchar_t appId[MAX_PATH] = { 0 };
|
||||||
@ -132,6 +132,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
|
|
||||||
std::wstring cmderStart = path;
|
std::wstring cmderStart = path;
|
||||||
std::wstring cmderTask = taskName;
|
std::wstring cmderTask = taskName;
|
||||||
|
std::wstring cmderTitle = title;
|
||||||
std::wstring cmderConEmuArgs = conemu_args;
|
std::wstring cmderConEmuArgs = conemu_args;
|
||||||
|
|
||||||
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
||||||
@ -412,7 +413,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe");
|
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""))
|
if (!streqi(cmderStart.c_str(), L""))
|
||||||
{
|
{
|
||||||
@ -429,6 +430,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());
|
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)
|
if (cfgRoot.length() != 0)
|
||||||
{
|
{
|
||||||
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
||||||
@ -574,6 +580,7 @@ struct cmderOptions
|
|||||||
std::wstring cmderCfgRoot = L"";
|
std::wstring cmderCfgRoot = L"";
|
||||||
std::wstring cmderStart = L"";
|
std::wstring cmderStart = L"";
|
||||||
std::wstring cmderTask = L"";
|
std::wstring cmderTask = L"";
|
||||||
|
std::wstring cmderTitle = L"Cmder";
|
||||||
std::wstring cmderIcon = L"";
|
std::wstring cmderIcon = L"";
|
||||||
std::wstring cmderRegScope = L"USER";
|
std::wstring cmderRegScope = L"USER";
|
||||||
std::wstring cmderConEmuArgs = L"";
|
std::wstring cmderConEmuArgs = L"";
|
||||||
@ -636,6 +643,11 @@ cmderOptions GetOption()
|
|||||||
cmderOptions.cmderTask = szArgList[i + 1];
|
cmderOptions.cmderTask = szArgList[i + 1];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
else if (_wcsicmp(L"/title", szArgList[i]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.cmderTitle = szArgList[i + 1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
else if (_wcsicmp(L"/icon", szArgList[i]) == 0)
|
else if (_wcsicmp(L"/icon", szArgList[i]) == 0)
|
||||||
{
|
{
|
||||||
cmderOptions.cmderIcon = szArgList[i + 1];
|
cmderOptions.cmderIcon = szArgList[i + 1];
|
||||||
@ -764,7 +776,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs);
|
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderTitle, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
0
launcher/src/strings.rc2
Executable file → Normal file
0
launcher/src/strings.rc2
Executable file → Normal file
@ -117,6 +117,7 @@ if ($ConEmuXml -ne "") {
|
|||||||
Pop-Location
|
Pop-Location
|
||||||
|
|
||||||
if($Compile) {
|
if($Compile) {
|
||||||
|
cmd.exe /C "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
Push-Location -Path $launcher
|
Push-Location -Path $launcher
|
||||||
Create-RC $version ($launcher + '\src\version.rc2');
|
Create-RC $version ($launcher + '\src\version.rc2');
|
||||||
# https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
|
# https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
|
||||||
|
Loading…
x
Reference in New Issue
Block a user