mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-05 13:19:03 +00:00
remove extra buttons from macOS
This commit is contained in:
parent
96571f2b31
commit
31ccd13ced
@ -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,6 +53,9 @@ require('electron').remote.getGlobal('setTimeout')(() => {
|
||||
buttons.className = 'window-buttons-area';
|
||||
buttons.innerHTML = `
|
||||
<button class="window-button btn-alwaysontop"></button>
|
||||
`;
|
||||
if (!isMac)
|
||||
buttons.innerHTML += `
|
||||
<button class="window-button btn-minimize"></button>
|
||||
<button class="window-button btn-maximize"></button>
|
||||
<button class="window-button btn-close"></button>
|
||||
@ -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,6 +121,7 @@ require('electron').remote.getGlobal('setTimeout')(() => {
|
||||
button_elements.alwaysontop.innerHTML = button_icons.alwaysontop();
|
||||
button_elements.alwaysontop.onclick = button_actions.alwaysontop;
|
||||
|
||||
if (!isMac) {
|
||||
button_elements.minimize.innerHTML = button_icons.minimize();
|
||||
button_elements.minimize.onclick = button_actions.minimize;
|
||||
|
||||
@ -128,6 +134,8 @@ 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(
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user