diff --git a/resources/preload.js b/resources/preload.js
index dee1712..2358aa2 100644
--- a/resources/preload.js
+++ b/resources/preload.js
@@ -22,7 +22,8 @@ require('electron').remote.getGlobal('setTimeout')(() => {
tray: false,
theme: false,
},
- });
+ }),
+ isMac = process.platform === 'darwin';
const intervalID = setInterval(injection, 100);
function injection() {
@@ -52,10 +53,13 @@ require('electron').remote.getGlobal('setTimeout')(() => {
buttons.className = 'window-buttons-area';
buttons.innerHTML = `
-
-
-
`;
+ if (!isMac)
+ buttons.innerHTML += `
+
+
+
+ `;
document
.querySelector('.notion-topbar > div[style*="display: flex"]')
.appendChild(buttons);
@@ -96,12 +100,13 @@ require('electron').remote.getGlobal('setTimeout')(() => {
: appwindow.maximize();
this.innerHTML = button_icons.maximize();
},
- close() {
+ close(event = null) {
if (
store.tray &&
require('electron').remote.BrowserWindow.getAllWindows().length ===
1
) {
+ if (event) event.preventDefault();
appwindow.hide();
} else appwindow.close();
},
@@ -116,18 +121,21 @@ require('electron').remote.getGlobal('setTimeout')(() => {
button_elements.alwaysontop.innerHTML = button_icons.alwaysontop();
button_elements.alwaysontop.onclick = button_actions.alwaysontop;
- button_elements.minimize.innerHTML = button_icons.minimize();
- button_elements.minimize.onclick = button_actions.minimize;
+ if (!isMac) {
+ button_elements.minimize.innerHTML = button_icons.minimize();
+ button_elements.minimize.onclick = button_actions.minimize;
- button_elements.maximize.innerHTML = button_icons.maximize();
- button_elements.maximize.onclick = button_actions.maximize;
- setInterval(() => {
- if (button_elements.maximize.innerHTML != button_icons.maximize())
- button_elements.maximize.innerHTML = button_icons.maximize();
- }, 1000);
+ button_elements.maximize.innerHTML = button_icons.maximize();
+ button_elements.maximize.onclick = button_actions.maximize;
+ setInterval(() => {
+ if (button_elements.maximize.innerHTML != button_icons.maximize())
+ button_elements.maximize.innerHTML = button_icons.maximize();
+ }, 1000);
- button_elements.close.innerHTML = button_icons.close();
- button_elements.close.onclick = button_actions.close;
+ 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(
diff --git a/resources/tray.js b/resources/tray.js
index b49c768..5628e28 100644
--- a/resources/tray.js
+++ b/resources/tray.js
@@ -36,7 +36,7 @@ function enhancements() {
const contextMenu = Menu.buildFromTemplate([
{
id: 'startup',
- label: 'run on startup',
+ label: 'Run on Startup',
type: 'checkbox',
checked: electron_1.app.getLoginItemSettings().openAtLogin,
click: () => {
@@ -48,7 +48,7 @@ function enhancements() {
},
{
id: 'openhidden',
- label: 'hide on open',
+ label: 'Hide on Open',
type: 'checkbox',
checked: store.openhidden,
click: () => {
@@ -58,7 +58,7 @@ function enhancements() {
},
{
id: 'maximized',
- label: 'open maximised',
+ label: 'Open Maximised',
type: 'checkbox',
checked: store.maximized,
click: () => {
@@ -68,7 +68,7 @@ function enhancements() {
},
{
id: 'tray',
- label: 'close to tray',
+ label: 'Close to Tray',
type: 'checkbox',
checked: store.tray,
click: () => {
@@ -78,7 +78,7 @@ function enhancements() {
},
{
id: 'theme',
- label: 'load theme.css',
+ label: 'Load Custom Theme',
type: 'checkbox',
checked: store.theme,
click: () => {
@@ -91,12 +91,12 @@ function enhancements() {
type: 'separator',
},
{
- label: '(x) quit',
+ label: 'Quit',
role: 'quit',
},
]);
tray.setContextMenu(contextMenu);
- tray.setToolTip('notion enhancements');
+ tray.setToolTip('Notion Enhancements');
function showWindows() {
const windows = electron_1.BrowserWindow.getAllWindows();