From 156b4061b098ec3aef5d35e22e1786c0c6fbaf40 Mon Sep 17 00:00:00 2001
From: dragonwocky <thedragonring.bod@gmail.com>
Date: Thu, 9 Jul 2020 18:26:29 +1000
Subject: [PATCH] support for notion-deb-builder

---
 README.md            | 26 ++++++++++++++++++++------
 customiser.py        | 12 ++++++++++--
 docs/index.html      | 24 ++++++++++++++++++------
 resources/preload.js |  2 --
 resources/tray.js    | 10 ++++------
 5 files changed, 52 insertions(+), 22 deletions(-)

diff --git a/README.md b/README.md
index 6ad6541..291673e 100644
--- a/README.md
+++ b/README.md
@@ -4,19 +4,33 @@ an enhancer/customiser for the all-in-one productivity workspace [notion.so](htt
 
 ## installation
 
-currently, both windows and linux are supported. it is possible to run this script via the WSL to modify the windows notion app.
+there are a lot of ways to use notion. some official clients, many not.
 
-**want macOS to be supported too? let me know, and I can work with you to get it going.**
+the enhancer supports:
 
-for linux users, the notion-app ([arch linux](https://aur.archlinux.org/packages/notion-app/),
-[others e.g. ubuntu](https://github.com/jaredallard/notion-app)) package will wrap/run the macOS version of the notion app with electron.
+- the windows/mac versions of the app downloadable from [https://notion.so/desktop](https://notion.so/desktop).
+- the arch linux AUR [notion-app](https://aur.archlinux.org/packages/notion-app/) package
+- the linux [notion-app](https://github.com/jaredallard/notion-app) installer
+- the debian [notion-deb-builder](https://github.com/davidbailey00/notion-deb-builder/tree/229f2868e117e81858618783b83babd00c595000).
+
+there are others, yes. the enhancer does not support them. you should not expect them to work.
+if for some reason you need to use one of them instead of the above listed ones, open a
+[platform support](https://github.com/dragonwocky/notion-enhancer/issues/new?assignees=&labels=enhancement&template=platform-support.md&title=) request.
+
+please do not modify the enhancer code specifically to work for your installation.
+if you have the know-how to do so, instead open a pull request with your changes
+so that proper support can be added for all users of that client.
+
+mobile clients are not supported and due to system limitations/restrictions cannot be.
 
 (the [styles](#styling) should also work for the web version.
 these can be installed via an extension like [stylus](https://chrome.google.com/webstore/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne?hl=en)
 or a built-in feature like [userChrome.css](https://www.userchrome.org/).)
 
-1. install node.js: [windows](https://nodejs.org/en/download/), [linux/WSL](https://github.com/mklement0/n-install).
-2. install python: [windows](https://www.python.org/downloads/windows/), [linux/WSL](https://docs.python-guide.org/starting/install3/linux/).
+if the script is run from the WSL, it will enhance the windows version of the app.
+
+1. install node.js: [windows/macOS](https://nodejs.org/en/download/), [linux/WSL](https://github.com/mklement0/n-install).
+2. install python: [windows/macOS](https://www.python.org/downloads/), [linux/WSL](https://docs.python-guide.org/starting/install3/linux/).
 3. reboot.
 4. in the appropriate terminal/command line, run `npm install -g asar` (check installation by running `asar`).
 5. [download this enhancer](https://github.com/dragonwocky/notion-enhancer/archive/master.zip) & extract
diff --git a/customiser.py b/customiser.py
index 100f58a..2f6a9ad 100755
--- a/customiser.py
+++ b/customiser.py
@@ -42,13 +42,21 @@ try:
         filepath = subprocess.run(['echo', '%localappdata%'], shell=True, capture_output=True).stdout \
             .rstrip().decode('utf-8') + '\\Programs\\Notion\\resources'
     elif sys.platform == 'linux':
-        filepath = '/opt/notion-app' if os.path.exists(
-            '/opt/notion-app') else '/opt/notion'
+        if os.path.exists('/opt/notion-app'):
+            filepath = '/opt/notion-app'
+        elif os.path.exists('/opt/notion'):
+            filepath = '/opt/notion'
+        elif os.path.exists('/usr/lib/notion-desktop/resources'):
+            filepath = '/usr/lib/notion-desktop/resources'
     elif sys.platform == 'darwin':
         filepath = '/Applications/Notion.app/Contents/Resources'
     else:
         print(' > script not compatible with your os!\n   (report this to dragonwocky#8449 on discord)')
         exit()
+    if not filepath or not os.path.exists(filepath):
+        print(
+            ' > nothing found: exiting. notion install is either corrupted or non-existent.')
+        exit()
 
     unpacking_asar = True
     if not os.path.isfile(os.path.join(filepath, 'app.asar')):
diff --git a/docs/index.html b/docs/index.html
index 6740e37..d5258ef 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -11,16 +11,28 @@
             <h2>
               <a href="#installation">installation</a>
             </h2>
-        <p>currently, both windows and linux are supported. it is possible to run this script via the WSL to modify the windows notion app.</p>
-<p><strong>want macOS to be supported too? let me know, and I can work with you to get it going.</strong></p>
-<p>for linux users, the notion-app (<a href="https://aur.archlinux.org/packages/notion-app/#" title="">arch linux</a>,
-<a href="https://github.com/jaredallard/notion-app#" title="">others e.g. ubuntu</a>) package will wrap/run the macOS version of the notion app with electron.</p>
+        <p>there are a lot of ways to use notion. some official clients, many not.</p>
+<p>the enhancer supports:</p>
+<ul>
+<li>the windows/mac versions of the app downloadable from <a href="https://notion.so/desktop#" title="">https://notion.so/desktop</a>.</li>
+<li>the arch linux AUR <a href="https://aur.archlinux.org/packages/notion-app/#" title="">notion-app</a> package</li>
+<li>the linux <a href="https://github.com/jaredallard/notion-app#" title="">notion-app</a> installer</li>
+<li>the debian <a href="https://github.com/davidbailey00/notion-deb-builder/tree/229f2868e117e81858618783b83babd00c595000#" title="">notion-deb-builder</a>.</li>
+</ul>
+<p>there are others, yes. the enhancer does not support them. you should not expect them to work.
+if for some reason you need to use one of them instead of the above listed ones, open a
+<a href="https://github.com/dragonwocky/notion-enhancer/issues/new?assignees=&labels=enhancement&template=platform-support.md&title=#" title="">platform support</a> request.</p>
+<p>please do not modify the enhancer code specifically to work for your installation.
+if you have the know-how to do so, instead open a pull request with your changes
+so that proper support can be added for all users of that client.</p>
+<p>mobile clients are not supported and due to system limitations/restrictions cannot be.</p>
 <p>(the <a href="#styling" title="">styles</a> should also work for the web version.
 these can be installed via an extension like <a href="https://chrome.google.com/webstore/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne?hl=en#" title="">stylus</a>
 or a built-in feature like <a href="https://www.userchrome.org/#" title="">userChrome.css</a>.)</p>
+<p>if the script is run from the WSL, it will enhance the windows version of the app.</p>
 <ol>
-<li>install node.js: <a href="https://nodejs.org/en/download/#" title="">windows</a>, <a href="https://github.com/mklement0/n-install#" title="">linux/WSL</a>.</li>
-<li>install python: <a href="https://www.python.org/downloads/windows/#" title="">windows</a>, <a href="https://docs.python-guide.org/starting/install3/linux/#" title="">linux/WSL</a>.</li>
+<li>install node.js: <a href="https://nodejs.org/en/download/#" title="">windows/macOS</a>, <a href="https://github.com/mklement0/n-install#" title="">linux/WSL</a>.</li>
+<li>install python: <a href="https://www.python.org/downloads/#" title="">windows/macOS</a>, <a href="https://docs.python-guide.org/starting/install3/linux/#" title="">linux/WSL</a>.</li>
 <li>reboot.</li>
 <li>in the appropriate terminal/command line, run <code>npm install -g asar</code> (check installation by running <code>asar</code>).</li>
 <li><a href="https://github.com/dragonwocky/notion-enhancer/archive/master.zip#" title="">download this enhancer</a> &amp; extract
diff --git a/resources/preload.js b/resources/preload.js
index dcbf4d9..a045bc2 100644
--- a/resources/preload.js
+++ b/resources/preload.js
@@ -134,8 +134,6 @@ require('electron').remote.getGlobal('setTimeout')(() => {
         close: document.querySelector('.window-button.btn-close'),
       };
 
-    console.log(button_icons_raw);
-
     button_elements.alwaysontop.innerHTML = button_icons.alwaysontop();
     button_elements.alwaysontop.onclick = button_actions.alwaysontop;
 
diff --git a/resources/tray.js b/resources/tray.js
index fae6be3..468d801 100644
--- a/resources/tray.js
+++ b/resources/tray.js
@@ -29,12 +29,10 @@ function enhancements() {
     });
   tray = new Tray(
     isMac
-      ? new nativeImage.createFromPath('☃☃☃resources☃☃☃/icons/logo.png').resize(
-          {
-            width: 16,
-            height: 16,
-          }
-        )
+      ? new nativeImage.createFromPath('☃☃☃resources☃☃☃/icons/mac.png').resize({
+          width: 16,
+          height: 16,
+        })
       : '☃☃☃resources☃☃☃/icons/tray.ico'
   );
   const contextMenu = Menu.buildFromTemplate([