Use KDSingleApplication as a submodule

This commit is contained in:
Jonas Kvinge
2023-10-21 05:43:48 +02:00
parent e8bcaf415c
commit 48685325e6
16 changed files with 40 additions and 710 deletions

View File

@@ -156,7 +156,11 @@ int main(int argc, char *argv[]) {
// Only start a core application now, so we can check if there's another instance without requiring an X server.
// This MUST be done before parsing the commandline options so QTextCodec gets the right system locale for filenames.
QCoreApplication core_app(argc, argv);
#ifdef HAVE_KDSINGLEAPPLICATION_OPTIONS
KDSingleApplication single_app(QCoreApplication::applicationName(), KDSingleApplication::Option::IncludeUsernameInSocketName);
#else
KDSingleApplication single_app(QCoreApplication::applicationName());
#endif
// Parse commandline options - need to do this before starting the full QApplication, so it works without an X server
if (!options.Parse()) return 1;
logging::SetLevels(options.log_levels());
@@ -193,7 +197,11 @@ int main(int argc, char *argv[]) {
QGuiApplication::setQuitOnLastWindowClosed(false);
QApplication a(argc, argv);
#ifdef HAVE_KDSINGLEAPPLICATION_OPTIONS
KDSingleApplication single_app(QCoreApplication::applicationName(), KDSingleApplication::Option::IncludeUsernameInSocketName);
#else
KDSingleApplication single_app(QCoreApplication::applicationName());
#endif
if (!single_app.isPrimaryInstance()) {
if (options.is_empty()) {
qLog(Info) << "Strawberry is already running - activating existing window (2)";