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 { x, y, width, height } = mainWindowState
const winOpt = Object.assign({ x, y, width, height }, { const winOpt = Object.assign({ x, y, width, height }, {
icon: path.join(__static, 'logo-96px.png'),
minWidth: 450,
minHeight: 220,
webPreferences: { webPreferences: {
webSecurity: false webSecurity: false
}, },

View File

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

BIN
static/logo-96px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB