From 15ace9d0947b2ad1e51081eb15b2eeb9d1baa63a Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 28 Jun 2020 02:24:41 -0500 Subject: [PATCH] Add flag to start application minimized to tray --- cli.cpp | 18 ++++++++++++++---- main.cpp | 17 +++++++++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/cli.cpp b/cli.cpp index 8164b9f96..ca90636c9 100644 --- a/cli.cpp +++ b/cli.cpp @@ -26,9 +26,10 @@ static std::string profile_save_filename = ""; enum { - RET_FLAG_PRINT_HELP = 1, - RET_FLAG_START_GUI = 2, - RET_FLAG_I2C_TOOLS = 4, + RET_FLAG_PRINT_HELP = 1, + RET_FLAG_START_GUI = 2, + RET_FLAG_I2C_TOOLS = 4, + RET_FLAG_START_MINIMIZED = 8, }; struct DeviceOptions @@ -348,9 +349,10 @@ void OptionHelp() help_text += "Usage: OpenRGB (--device [--mode] [--color])...\n"; help_text += "\n"; help_text += "Options:\n"; + help_text += "--gui Shows the GUI. GUI also appears when not passing any parameters\n"; + help_text += "--startminimized Starts the GUI minimized to tray. Implies --gui, even if not specified\n"; help_text += "--server Starts the SDK's server\n"; help_text += "--server-port Sets the SDK's server port. Default: 6742 (1024-65535)\n"; - help_text += "--gui Shows the GUI, also appears when not passing any parameters\n"; help_text += "-l, --list-devices Lists every compatible device with their number\n"; help_text += "-d, --device [0-9] Selects device to apply colors and/or effect to, or applies to all devices if omitted\n"; help_text += " Can be specified multiple times with different modes and colors\n"; @@ -723,6 +725,14 @@ int ProcessOptions(int argc, char *argv[], Options *options) ret_flags |= RET_FLAG_I2C_TOOLS; } + /*---------------------------------------------------------*\ + | --startminimized | + \*---------------------------------------------------------*/ + else if(option == "--startminimized") + { + ret_flags |= RET_FLAG_START_GUI | RET_FLAG_START_MINIMIZED; + } + /*---------------------------------------------------------*\ | -h / --help (no arguments) | \*---------------------------------------------------------*/ diff --git a/main.cpp b/main.cpp index d5004c5cb..8efc9c29f 100644 --- a/main.cpp +++ b/main.cpp @@ -28,9 +28,10 @@ extern unsigned int cli_main(int argc, char *argv[], std::vector