close to tray for macOS's native close window button

This commit is contained in:
dragonwocky 2020-07-09 18:50:50 +10:00
parent 422be7410a
commit 0e168b5f84
Signed by: dragonwocky
GPG Key ID: C7A48B7846AA706D
4 changed files with 18 additions and 5 deletions

View File

@ -8,6 +8,7 @@ but can still easily be enabled by following instructions in the [docs](README.m
- new: mac support (identical functionality to others platforms with the
exception of the native minimise/maximise/close buttons being kept, as they integrate
better with the OS while not being out-of-place in notion).
- new: notion-deb-builder support for linux.
- improved: replaced button symbols with svgs for multi-platform support.
- improved: window close button is now red on hover (thanks to [@torchatlas](https://github.com/torchatlas)).
- bugfix: `cleaner.py` patched for linux.

View File

@ -2,13 +2,13 @@
an enhancer/customiser for the all-in-one productivity workspace [notion.so](https://www.notion.so/)
## installation
## supported clients
there are a lot of ways to use notion. some official clients, many not.
the enhancer supports:
- the windows/mac versions of the app downloadable from [https://notion.so/desktop](https://notion.so/desktop).
- the [official windows/mac releases](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).
@ -29,6 +29,8 @@ or a built-in feature like [userChrome.css](https://www.userchrome.org/).)
if the script is run from the WSL, it will enhance the windows version of the app.
## installation
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.

View File

@ -13,7 +13,7 @@ from shutil import copyfile, rmtree
from time import sleep
# to smooth the update process
enhancer_version = '0.6.1~beta3'
enhancer_version = '0.6.1~beta4'
# for toggling notion visibility
hotkey = 'CmdOrCtrl+Shift+A'
@ -149,11 +149,22 @@ try:
config: 'user-preferences',
defaults: {
openhidden: false,
maximized: false
maximized: false,
tray: false,
}
});
if (!store.openhidden || electron_1.BrowserWindow.getAllWindows().some(win => win.isVisible()))
{ window.show(); if (store.maximized) window.maximize(); }
let appQuit = false;
window.on('close', (e) => {
if (appQuit || !store.tray) window = null;
else {
e.preventDefault();
window.hide();
}
});
electron_1.app.on('activate', () => window.show());
electron_1.app.on('before-quit', () => (appQuit = true));
/* === INJECTION END === */
""")
with open(os.path.join(filepath, "app", "main", "createWindow.js"), 'w', encoding='UTF-8') as write:

View File

@ -151,7 +151,6 @@ require('electron').remote.getGlobal('setTimeout')(() => {
button_elements.close.innerHTML = button_icons.close();
button_elements.close.onclick = button_actions.close;
}
appwindow.on('close', button_actions.close);
/* hotkey: reload window */
document.defaultView.addEventListener(