Browse Source

Merge pull request #490 from weeman1337/tray-option-369

Adds an option to control the behavior on closing the main window
pull/591/head
Ramiro Saenz 8 years ago committed by GitHub
parent
commit
b2df94324d
  1. 33
      app/view/preferences/Preferences.js
  2. 21
      electron/main.js

33
app/view/preferences/Preferences.js

@ -67,17 +67,28 @@ Ext.define('Rambox.view.preferences.Preferences',{
,boxLabel: 'Show in Taskbar' ,boxLabel: 'Show in Taskbar'
,value: config.skip_taskbar ,value: config.skip_taskbar
,reference: 'skipTaskbar' ,reference: 'skipTaskbar'
,hidden: process.platform !== 'win32' ,hidden: process.platform === 'darwin'
} },
,{ {
xtype: 'checkbox' xtype: 'combo',
,name: 'keep_in_taskbar_on_close' name: 'window_close_behavior',
,boxLabel: 'Keep Rambox in the Taskbar when close it' fieldLabel: 'When closing the main window',
,value: config.keep_in_taskbar_on_close labelAlign: 'top',
,bind: { disabled: '{!skipTaskbar.checked}' } value: config.window_close_behavior,
,hidden: process.platform !== 'win32' displayField: 'label',
} valueField: 'value',
,{ editable: false,
store: Ext.create('Ext.data.Store', {
fields: ['value', 'label'],
data : [
{ 'value': 'keep_in_tray', 'label': 'Keep in tray' },
{ 'value': 'keep_in_tray_and_taskbar', 'label': 'Keep in tray and taskbar' },
{ 'value': 'quit', 'label': 'Quit' }
]
}),
hidden: process.platform === 'darwin'
},
{
xtype: 'checkbox' xtype: 'checkbox'
,name: 'always_on_top' ,name: 'always_on_top'
,boxLabel: 'Always on top' ,boxLabel: 'Always on top'

21
electron/main.js

@ -23,10 +23,9 @@ const config = new Config({
always_on_top: false always_on_top: false
,hide_menu_bar: false ,hide_menu_bar: false
,skip_taskbar: true ,skip_taskbar: true
,auto_launch: !isDev ,auto_launch: !isDev,
// On Linux false because it's uncommon for apps on linux to stay in the taskbar on close window_close_behavior: 'keep_in_tray',
,keep_in_taskbar_on_close: process.platform !== 'linux' start_minimized: false
,start_minimized: false
,systemtray_indicator: true ,systemtray_indicator: true
,master_password: false ,master_password: false
,disable_gpu: process.platform === 'linux' ,disable_gpu: process.platform === 'linux'
@ -199,11 +198,19 @@ function createWindow () {
app.hide(); app.hide();
break; break;
case 'linux': case 'linux':
config.get('keep_in_taskbar_on_close') ? mainWindow.hide() : app.quit();
break;
case 'win32': case 'win32':
default: default:
config.get('keep_in_taskbar_on_close') ? mainWindow.minimize() : mainWindow.hide(); switch (config.get('window_close_behavior')) {
case 'keep_in_tray':
mainWindow.hide();
break;
case 'keep_in_tray_and_taskbar':
mainWindow.minimize();
break;
case 'quit':
app.quit();
break;
}
break; break;
} }
} }

Loading…
Cancel
Save