File SingleApplication.patch of Package qvkbd
diff --git a/qvkbd.pro b/qvkbd.pro
index 4db4c76..0b2fc17 100644
--- a/qvkbd.pro
+++ b/qvkbd.pro
@@ -15,11 +15,16 @@ TEMPLATE = app
LIBS += -lXtst
+# Single Application implementation
+include(src/third-party/singleapplication/singleapplication.pri)
+
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
+DEFINES += \
+ QAPPLICATION_CLASS=QApplication \
+ QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
diff --git a/src/main.cpp b/src/main.cpp
index 6c393e6..f32f235 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,8 +17,20 @@
*
*/
#include "vkbdapp.h"
+#include "singleapplication.h"
+int onlyOne(int argc, char *argv[]);
int main(int argc, char *argv[]) {
VKbdApp app(argc, argv);
return app.exec();
+ if (argc == 1)
+ return onlyOne(argc, argv);
+}
+int onlyOne(int argc, char *argv[]){
+ SingleApplication app(argc, argv);
+
+ SingleApplication::setApplicationName(QStringLiteral("qvkbd"));
+ SingleApplication::setOrganizationName(QStringLiteral("Eternal Search"));
+
+ return SingleApplication::exec();
}