feat(tray): tray hide on closing #32

This commit is contained in:
Alexey Kasyanchuk 2018-05-29 14:48:48 +03:00
parent ae8b84fed6
commit 50a95aeb72
6 changed files with 46 additions and 5 deletions

View File

@ -161,6 +161,26 @@ export default class ConfigPage extends Page {
}} />
</div>
<Toggle
style={{marginTop: '10px'}}
label={__('Hide to tray on application minimize')}
toggled={this.options.trayOnMinimize}
onToggle={(e, checked) => {
this.options.trayOnMinimize = checked
this.forceUpdate()
}}
/>
<Toggle
style={{marginTop: '10px'}}
label={__('Hide to tray on application close')}
toggled={this.options.trayOnClose}
onToggle={(e, checked) => {
this.options.trayOnClose = checked
this.forceUpdate()
}}
/>
<div style={{marginTop: 10}}>{__('P2P Rats network settings')}:</div>
<Toggle
style={{marginTop: '10px'}}

View File

@ -178,13 +178,24 @@ app.on("ready", () => {
mainWindow.on('hide', () => {
tray.setHighlightMode('never')
})
mainWindow.on('close', (event) => {
if (!app.isQuiting && appConfig.trayOnClose && process.platform !== 'linux') {
event.preventDefault()
mainWindow.hide()
return
}
})
mainWindow.on('closed', () => {
mainWindow = undefined
})
mainWindow.on('minimize', (event) => {
event.preventDefault();
mainWindow.hide();
if(appConfig.trayOnMinimize)
{
event.preventDefault();
mainWindow.hide();
}
});
var contextMenu = Menu.buildFromTemplate([
@ -260,6 +271,7 @@ app.on("window-all-closed", () => {
});
app.on('before-quit', () => {
app.isQuiting = true
if (sphinx)
stop()
})

View File

@ -19,6 +19,9 @@ let config = {
upnp: true,
trayOnClose: false,
trayOnMinimize: true,
sitemapMaxSize: 25000,
sphinx: {

View File

@ -155,6 +155,8 @@
"We are not responsible for any content": "We are not responsible for any content",
"this is only information about content that collected automatically": "this is only information about content that collected automatically",
"no torrents for": "no torrents for",
"were found": "were found"
"were found": "were found",
"Hide to tray on application minimize": "Hide to tray on application minimize",
"Hide to tray on application close": "Hide to tray on application close"
}
}

View File

@ -155,6 +155,8 @@
"We are not responsible for any content": "Мы не несем отвественность за контент",
"this is only information about content that collected automatically": "это лишь информация, собранная автоматически",
"no torrents for": "0 торрентов для",
"were found": "было найдено"
"were found": "было найдено",
"Hide to tray on application minimize": "Сворачивать в трей при сворачивании приложения",
"Hide to tray on application close": "Сворачивать в трей при закрытии приложения"
}
}

View File

@ -155,6 +155,8 @@
"We are not responsible for any content": "Ми не несемо відповідальність за контент",
"this is only information about content that collected automatically": "це лише інформація, яку зібрано автоматично",
"no torrents for": "0 торентів для",
"were found": "було знайдено"
"were found": "було знайдено",
"Hide to tray on application minimize": "Hide to tray on application minimize",
"Hide to tray on application close": "Hide to tray on application close"
}
}