Skip to content

Commit

Permalink
FEAT(client): Add --hidden cli option to start Mumble hidden in tray
Browse files Browse the repository at this point in the history
This commit introduces the "--hidden" cli option which prevents
Mumble and the ConnectDialog to show up on startup.
This is especially useful for users who want to automate the
startup process without human interaction.

Fixes #3879
  • Loading branch information
Hartmnt committed Jun 14, 2024
1 parent 77962f4 commit 38aace8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/mumble/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ int main(int argc, char **argv) {
bool customJackClientName = false;
bool bRpcMode = false;
bool printTranslationDirs = false;
bool startHiddenInTray = false;
QString rpcCommand;
QUrl url;
QDir qdCert(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
Expand Down Expand Up @@ -288,7 +289,9 @@ int main(int argc, char **argv) {
" locale that corresponds to the given locale string.\n"
" If the format is invalid, Mumble will error.\n"
" Otherwise the locale will be permanently saved to\n"
" Mumble's settings."
" Mumble's settings.\n"
" --hidden\n"
" Start Mumble hidden in the system tray."
"\n");
QString rpcHelpBanner = MainWindow::tr("Remote controlling Mumble:\n"
"\n");
Expand Down Expand Up @@ -415,6 +418,9 @@ int main(int argc, char **argv) {
qCritical("Missing argument for --locale!");
return 1;
}
} else if (args.at(i) == "--hidden") {
startHiddenInTray = true;
qInfo("Starting hidden in system tray");
} else if (args.at(i) == "--version") {
// Print version and exit (print to regular std::cout to avoid adding any useless meta-information from
// using e.g. qWarning
Expand Down Expand Up @@ -684,7 +690,9 @@ int main(int argc, char **argv) {

// Main Window
Global::get().mw = new MainWindow(nullptr);
Global::get().mw->show();
if (!startHiddenInTray) {
Global::get().mw->showRaiseWindow();
}

Global::get().trayIcon = new TrayIcon();

Expand Down Expand Up @@ -799,7 +807,7 @@ int main(int argc, char **argv) {
OpenURLEvent *oue = new OpenURLEvent(a.quLaunchURL);
qApp->postEvent(Global::get().mw, oue);
#endif
} else {
} else if (!startHiddenInTray) {
Global::get().mw->on_qaServerConnect_triggered(true);
}

Expand Down

0 comments on commit 38aace8

Please sign in to comment.