Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjocoleman/6279ea9f11885f13383867a9b70408a9 to your computer and use it in GitHub Desktop.
Save rjocoleman/6279ea9f11885f13383867a9b70408a9 to your computer and use it in GitHub Desktop.
diff --git a/PKGBUILD b/PKGBUILD
index ca01b21..413ca01 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
pkgname=standardnotes-desktop
_pkgname=desktop
pkgver=3.0.12
-pkgrel=1
+pkgrel=2
pkgdesc="A standard notes app with an un-standard focus on longevity, portability, and privacy."
arch=('x86_64')
url="https://standardnotes.org/"
@@ -14,10 +14,12 @@ source=("git://github.com/standardnotes/desktop.git"
"git://github.com/sn-extensions/extensions-manager.git"
"git://github.com/sn-extensions/batch-manager.git"
'standardnotes-desktop.desktop'
- 'standardnotes-desktop.js')
+ 'standardnotes-desktop.js'
+ 'fix-electron-deprecations.patch')
sha256sums=('SKIP' 'SKIP' 'SKIP'
'11e0f47494b09b95710399427f849d5693e97e39e7346469ac82da61138b7ca6'
- '16934b1dc1d88d668dd657e991cc58c7292a398fec3aab193478e9988882673d')
+ '16934b1dc1d88d668dd657e991cc58c7292a398fec3aab193478e9988882673d'
+ '4572643e004de151e19079e60b1327e389429455b3db49358b6298c9dec8a9d4')
prepare() {
cd $_pkgname
@@ -26,6 +28,8 @@ prepare() {
git config submodule.extensions-manager.url $srcdir/extensions-manager
git config submodule.batch-manager.url $srcdir/batch-manager
git submodule update
+
+ patch -Np1 -i "${srcdir}/fix-electron-deprecations.patch"
}
build() {
diff --git a/fix-electron-deprecations.patch b/fix-electron-deprecations.patch
new file mode 100644
index 0000000..dbaacad
--- /dev/null
+++ b/fix-electron-deprecations.patch
@@ -0,0 +1,46 @@
+From cfffe17c04ceef2ef76415ea8342d5b5fed734dc Mon Sep 17 00:00:00 2001
+From: Robert Coleman <github@robert.net.nz>
+Date: Sun, 9 Jun 2019 09:04:07 +1200
+Subject: [PATCH] add feature flag for single instance (see #358)
+
+---
+ app/index.js | 22 +++++++++++++++++++---
+ 1 file changed, 19 insertions(+), 3 deletions(-)
+
+diff --git a/app/index.js b/app/index.js
+index d02ccd3..8dd68da 100644
+--- a/app/index.js
++++ b/app/index.js
+@@ -152,13 +152,29 @@ app.on('activate', function() {
+ updateManager.checkForUpdate();
+ });
+
+-const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory) => {
+- // Someone tried to run a second instance, we should focus our window.
++// feature flag: https://github.com/electron/electron/blob/master/docs/api/breaking-changes.md#appmakesingleinstance
++const hasRequestSingleInstanceLock = app.requestSingleInstanceLock ? true : false;
++let isSecondInstance = null;
++
++// Someone tried to run a second instance, we should focus our window.
++const handleSecondInstance = (argv, cwd) => {
+ if (win) {
+ if (win.isMinimized()) win.restore()
+ win.focus()
+ }
+-})
++}
++
++if (hasRequestSingleInstanceLock) {
++ isSecondInstance = !app.requestSingleInstanceLock()
++
++ app.on('second-instance', (event, argv, cwd) => {
++ handleSecondInstance(argv, cwd)
++ })
++} else {
++ isSecondInstance = app.makeSingleInstance((argv, cwd) => {
++ handleSecondInstance(argv, cwd)
++ })
++}
+
+ app.on('ready', function(){
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment