Allow exiting full screen with maximize button on windows (#109)

This commit is contained in:
Felix Häusler 2018-03-31 11:33:02 +02:00 committed by 冉四夕
parent 12fa87fa99
commit 723fec398b
3 changed files with 21 additions and 4 deletions

View File

@ -17,6 +17,9 @@ const createWindow = (pathname, options = {}) => {
const { x, y, width, height } = mainWindowState
const winOpt = Object.assign({ x, y, width, height }, {
icon: path.join(__static, 'logo-96px.png'),
minWidth: 450,
minHeight: 220,
webPreferences: {
webSecurity: false
},

View File

@ -13,14 +13,22 @@
<span class="save-dot" :class="{'show': !isSaved}"></span>
</div>
<div :class="platform === 'win32' ? 'left-toolbar' : 'right-toolbar'">
<div v-if="platform === 'win32'" class="windows-titlebar-menu title-no-drag" @click.stop="handleMenuClick">&#9776;</div>
<div
v-if="platform === 'win32'"
class="windows-titlebar-menu title-no-drag"
@click.stop="handleMenuClick"
>&#9776;</div>
<div
class="word-count"
:class="[{ 'title-no-drag': platform === 'win32' }]"
@click.stop="handleWordClick"
>{{ `${HASH[show]} ${wordCount[show]}` }}</div>
</div>
<div v-if="platform === 'win32'" class="right-toolbar" :class="[{ 'title-no-drag': platform === 'win32' }]">
<div
v-if="platform === 'win32'"
class="right-toolbar"
:class="[{ 'title-no-drag': platform === 'win32' }]"
>
<div class="windows-titlebar-close" @click.stop="handleCloseClick">&times;</div>
<div class="windows-titlebar-toggle" @click.stop="handleMaximizeClick">&#9633;</div>
<div class="windows-titlebar-minimize" @click.stop="handleMinimizeClick">&minus;</div>
@ -67,20 +75,26 @@
if (index >= len) index = 0
this.show = ITEMS[index]
},
handleCloseClick () {
remote.getCurrentWindow().close()
},
handleMaximizeClick () {
const win = remote.getCurrentWindow()
if (win.isMaximized()) {
if (win.isFullScreen()) {
win.setFullScreen(false)
} else if (win.isMaximized()) {
win.unmaximize()
} else {
win.maximize()
}
},
handleMinimizeClick () {
remote.getCurrentWindow().minimize()
},
handleMenuClick () {
const win = remote.getCurrentWindow()
remote
@ -137,7 +151,7 @@
visibility: hidden;
}
.active .save-dot.show {
visibility: visible;
visibility: visible;
}
.title:hover {
color: #303133;

BIN
static/logo-96px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB