aboutsummaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorakshitkrnagpal <akshitkrnagpal@gmail.com>2018-07-12 03:53:40 +0530
committerSaúl Ibarra Corretgé <s@saghul.net>2018-07-15 08:24:54 +0200
commit26b55c75599b10a0d83681de815920554b7a6ddc (patch)
treebf649739c7b8a2d55f57757402bd20efeb0976c6 /main.js
parentfae2c069b38618ac9b3c9b5b121387e91fedecb2 (diff)
Force single instance application
Diffstat (limited to 'main.js')
-rw-r--r--main.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/main.js b/main.js
index a8b1045..9bf1f59 100644
--- a/main.js
+++ b/main.js
@@ -43,6 +43,30 @@ const indexURL = URL.format({
let jitsiMeetWindow = null;
/**
+ * Force Single Instance Application
+ */
+const isSecondInstance = APP.makeSingleInstance(() => {
+ /**
+ * If someone creates second instance of the application, set focus on
+ * existing window.
+ */
+ if (jitsiMeetWindow) {
+ if (jitsiMeetWindow.isMinimized()) {
+ jitsiMeetWindow.restore();
+ }
+ jitsiMeetWindow.focus();
+ }
+});
+
+/**
+ * We should quit the second instance.
+ */
+if (isSecondInstance) {
+ APP.quit();
+ process.exit(0);
+}
+
+/**
* Sets the APP object listeners.
*/
function setAPPListeners() {