Add CLI option to open main window when launching instance (#5107)

This commit is contained in:
DioEgizio 2026-03-21 13:17:28 +00:00 committed by GitHub
commit 03543a0cbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -318,6 +318,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
{ { "a", "profile" }, "Use the account specified by its profile name (only valid in combination with --launch)", "profile" },
{ { "o", "offline" }, "Launch offline, with given player name (only valid in combination with --launch)", "offline" },
{ "alive", "Write a small '" + liveCheckFile + "' file after the launcher starts" },
{ "show-window", "Show the main launcher window (useful in combination with --launch)" },
{ { "I", "import" }, "Import instance or resource from specified local path or URL", "url" },
{ "show", "Opens the window for the specified instance (by instance ID)", "show" } });
// Has to be positional for some OS to handle that properly
@ -339,6 +340,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
m_liveCheck = parser.isSet("alive");
m_instanceIdToShowWindowOf = parser.value("show");
m_showMainWindow = parser.isSet("show-window");
for (auto url : parser.values("import")) {
m_urlsToImport.append(normalizeImportUrl(url));
@ -1353,7 +1355,10 @@ void Application::performMainStartupAction()
}
launch(inst, m_launchOffline ? LaunchMode::Offline : LaunchMode::Normal, targetToJoin, accountToUse, m_offlineName);
return;
if (!m_showMainWindow) {
return;
}
}
}
if (!m_instanceIdToShowWindowOf.isEmpty()) {

View file

@ -314,6 +314,7 @@ class Application : public QApplication {
bool m_liveCheck = false;
QList<QUrl> m_urlsToImport;
QString m_instanceIdToShowWindowOf;
bool m_showMainWindow = false;
std::unique_ptr<QFile> logFile;
std::unique_ptr<LogModel> logModel;