aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop/main.js
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2018-10-04 11:52:34 +1200
committerDevine Lu Linvega <[email protected]>2018-10-04 11:52:34 +1200
commit17c7ea87ffe327b34c94b26f85a189662d31b9da (patch)
treee2d0a3b36e0171f46581e73e87a2ab8b96a8ba51 /desktop/main.js
parent20a2dc2817f34704776313a21ae48b0bb88ee04f (diff)
downloadOrca-17c7ea87ffe327b34c94b26f85a189662d31b9da.tar.gz
Orca-17c7ea87ffe327b34c94b26f85a189662d31b9da.zip
Standard
Diffstat (limited to 'desktop/main.js')
-rw-r--r--desktop/main.js58
1 files changed, 25 insertions, 33 deletions
diff --git a/desktop/main.js b/desktop/main.js
index a67fde4..9a5fe42 100644
--- a/desktop/main.js
+++ b/desktop/main.js
@@ -1,4 +1,4 @@
-const {app, BrowserWindow, webFrame, Menu} = require('electron')
+const { app, BrowserWindow, webFrame, Menu } = require('electron')
const path = require('path')
const url = require('url')
const shell = require('electron').shell
@@ -7,17 +7,16 @@ let is_shown = true
app.win = null
-app.on('ready', () =>
-{
+app.on('ready', () => {
app.win = new BrowserWindow({
- width: 510,
- height: 510,
- minWidth:510,
- minHeight:510,
- frame:false,
+ width: 510,
+ height: 510,
+ minWidth: 510,
+ minHeight: 510,
+ frame: false,
autoHideMenuBar: true,
- backgroundColor: '#000000',
- resizable:true,
+ backgroundColor: '#000000',
+ resizable: true,
autoHideMenuBar: true,
icon: __dirname + '/icon.ico'
})
@@ -30,16 +29,15 @@ app.on('ready', () =>
app.quit()
})
- app.win.on('hide',function() {
+ app.win.on('hide', function () {
is_shown = false
})
- app.win.on('show',function() {
+ app.win.on('show', function () {
is_shown = true
})
- app.on('window-all-closed', () =>
- {
+ app.on('window-all-closed', () => {
app.quit()
})
@@ -50,32 +48,26 @@ app.on('ready', () =>
})
})
-app.inspect = function()
-{
+app.inspect = function () {
app.win.toggleDevTools()
}
-app.toggle_fullscreen = function()
-{
- app.win.setFullScreen(app.win.isFullScreen() ? false : true)
+app.toggle_fullscreen = function () {
+ app.win.setFullScreen(!app.win.isFullScreen())
}
-app.toggle_visible = function()
-{
- if(process.platform == "win32"){
- if(!app.win.isMinimized()){ app.win.minimize(); } else{ app.win.restore(); }
- }
- else{
- if(is_shown && !app.win.isFullScreen()){ app.win.hide(); } else{ app.win.show(); }
+app.toggle_visible = function () {
+ if (process.platform == 'win32') {
+ if (!app.win.isMinimized()) { app.win.minimize() } else { app.win.restore() }
+ } else {
+ if (is_shown && !app.win.isFullScreen()) { app.win.hide() } else { app.win.show() }
}
}
-app.inject_menu = function(menu)
-{
- try{
+app.inject_menu = function (menu) {
+ try {
Menu.setApplicationMenu(Menu.buildFromTemplate(menu))
+ } catch (err) {
+ console.warn('Cannot inject menu.')
}
- catch(err){
- console.warn("Cannot inject menu.")
- }
-} \ No newline at end of file
+}