Skip to content

Commit

Permalink
Add --minimized CLI option
Browse files Browse the repository at this point in the history
  • Loading branch information
outfoxxed authored and droidmonkey committed Feb 9, 2025
1 parent 15ac8ac commit c9a64be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/man/keepassxc.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Your database works offline and requires no internet connection.
*--pw-stdin*::
Reads password of the database from stdin.

*--minimized*::
Starts KeePassXC minimized to the system tray.

*--debug-info*::
Displays debugging information.

Expand Down
4 changes: 4 additions & 0 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9224,6 +9224,10 @@ This option is deprecated, use --set-key-file instead.</source>
<source>Passkey</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>start minimized to the system tray</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QtIOCompressor</name>
Expand Down
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ int main(int argc, char** argv)
QCommandLineOption pwstdinOption("pw-stdin", QObject::tr("read password of the database from stdin"));
QCommandLineOption allowScreenCaptureOption("allow-screencapture",
QObject::tr("allow screenshots and app recording (Windows/macOS)"));
QCommandLineOption startMinimized("minimized", QObject::tr("start minimized to the system tray"));

QCommandLineOption helpOption = parser.addHelpOption();
QCommandLineOption versionOption = parser.addVersionOption();
Expand All @@ -95,6 +96,7 @@ int main(int argc, char** argv)
parser.addOption(pwstdinOption);
parser.addOption(debugInfoOption);
parser.addOption(allowScreenCaptureOption);
parser.addOption(startMinimized);

parser.process(app);

Expand Down Expand Up @@ -207,7 +209,7 @@ int main(int argc, char** argv)
}

// start minimized if configured
if (config()->get(Config::GUI_MinimizeOnStartup).toBool()) {
if (parser.isSet(startMinimized) || config()->get(Config::GUI_MinimizeOnStartup).toBool()) {
mainWindow.hideWindow();
} else {
mainWindow.bringToFront();
Expand Down

0 comments on commit c9a64be

Please sign in to comment.