added title bar buttons

This commit is contained in:
zadam 2019-12-23 13:34:54 +01:00
parent 7c8e7a3f4b
commit 4cececafc9
4 changed files with 45 additions and 4 deletions

View File

@ -176,4 +176,30 @@ noteAutocompleteService.init();
if (utils.isElectron()) {
import("./services/spell_check.js").then(spellCheckService => spellCheckService.initSpellCheck());
}
if (utils.isElectron()) {
$("#title-bar-buttons").show();
$("#minimize-btn").on('click', () => {
const { remote } = require('electron');
remote.BrowserWindow.getFocusedWindow().minimize();
});
$("#maximize-btn").on('click', () => {
const { remote } = require('electron');
const focusedWindow = remote.BrowserWindow.getFocusedWindow();
if (focusedWindow.isMaximized()) {
focusedWindow.unmaximize();
}
else {
focusedWindow.maximize();
}
});
$("#close-btn").on('click', () => {
const { remote } = require('electron');
remote.BrowserWindow.getFocusedWindow().close();
});
}

View File

@ -498,4 +498,8 @@ body {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#title-bar-buttons {
min-width: 100px;
}

View File

@ -474,6 +474,11 @@ button.icon-button {
width: 15em;
}
#global-menu button {
height: 38px;
margin-right: 10px;
}
#global-menu .dropdown-menu {
width: 20em;
}

View File

@ -12,10 +12,6 @@
<div id="container" style="display: none; grid-template-columns: minmax(<%= leftPaneMinWidth %>px, <%= leftPaneWidthPercent %>fr) minmax(0, <%= rightPaneWidthPercent %>fr)">
<div style="display: flex;">
<div class="note-tab-row hide-in-zen-mode">
<div class="note-tab-row-content"></div>
</div>
<div>
<div class="dropdown" id="global-menu">
<button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-sm dropdown-toggle">
@ -88,6 +84,16 @@
</div>
</div>
</div>
<div class="note-tab-row hide-in-zen-mode">
<div class="note-tab-row-content"></div>
</div>
<div id="title-bar-buttons" style="display: hidden">
<button class="btn icon-action bx bx-minus" id="minimize-btn"></button>
<button class="btn icon-action bx bx-checkbox" id="maximize-btn"></button>
<button class="btn icon-action bx bx-x" id="close-btn"></button>
</div>
</div>
<div id="header" class="hide-in-zen-mode">