diff --git a/main.cpp b/main.cpp index f58d6c5c..7687d79e 100644 --- a/main.cpp +++ b/main.cpp @@ -123,30 +123,32 @@ static int myCvErrorCallback( int /*status*/, const char* /*func_name*/, int main(int argc, char *argv[]) { - // DFTFringe doesn't have a good darkmode palette - // one could call "DFTFringe.exe -platform windows:darkmode=1" to disable dark mode (except for app borders) - // Following code adds the platform argument programmatically - - // Create a new argv array with existing args plus platform args - int newArgc = argc + 2; - std::vector args; - args.reserve(newArgc); - // Copy existing arguments - for (int i = 0; i < argc; ++i) { - args.emplace_back(argv[i]); - } - // Add new arguments - args.emplace_back("-platform"); - args.emplace_back("windows:darkmode=1"); - // Build non-const char* array - std::vector newArgv; - newArgv.reserve(newArgc); - for (auto &arg : args) { - newArgv.push_back(&arg[0]); // C++11 guarantees contiguous storage - } - - // Allow secondary instances - SingleApplication app( newArgc, newArgv.data(), true ); + #ifdef _WIN32 + // DFTFringe doesn't have a good darkmode palette + // one could call "DFTFringe.exe -platform windows:darkmode=1" to disable dark mode (except for app borders) + // Following code adds the platform argument programmatically + // Create a new argv array with existing args plus platform args + int newArgc = argc + 2; + std::vector args; + args.reserve(newArgc); + // Copy existing arguments + for (int i = 0; i < argc; ++i) { + args.emplace_back(argv[i]); + } + // Add new arguments + args.emplace_back("-platform"); + args.emplace_back("windows:darkmode=1"); + // Build non-const char* array + std::vector newArgv; + newArgv.reserve(newArgc); + for (auto &arg : args) { + newArgv.push_back(&arg[0]); // C++11 guarantees contiguous storage + } + // Allow secondary instances + SingleApplication app( newArgc, newArgv.data(), true ); + #else + SingleApplication app( argc, argv, true ); + #endif MessageReceiver msgReceiver;