forked from davidferguson/pibakery
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
executable file
·86 lines (71 loc) · 2.88 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
PiBakery - The easiest way to setup a Raspberry Pi
Copyright (C) 2016 David Ferguson
This file is part of PiBakery.
PiBakery is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
PiBakery is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
PiBakery. If not, see <http://www.gnu.org/licenses/>.
PiBakery uses Google Blockly which is licensed under the Apache License
Version 2.0, a copy of which can be found in the file ./app/blockly/LICENSE
PiBakery uses Win32DiskImager (Image Writer for Windows) which is licensed
under the GNU General Public License as published by the Free Software
Foundation, version 2 or later, a copy of which can be found in the file
./CommandLineDiskImager/GPL-2
PiBakery uses p7zip which is licensed under the GNU General Public License
as published by the Free Software Foundation, version 2.1 or later, a copy
of which can be found in the file p7zip-license.txt
PiBakery uses 7zip (7za) which is licensed under the GNU Lesser General
Public License as published by the Free Software Foundation, version 2.1 or
later, a copy of which can be found in the file 7zip-license.txt
*/
'use strict';
const fs = require('fs-extra');
const electron = require('electron');
const elevate = require('./elevate');
const electronLocalshortcut = require('electron-localshortcut');
const path = require("path");
electron.app.on('ready', function()
{
elevate.require(electron.app, function(error)
{
if (error) {
electron.dialog.showErrorBox('Elevation Error', error.message);
return process.exit(1);
}
var mainWindow = new electron.BrowserWindow({
height: 480,
width: 640,
minHeight: 480,
minWidth: 640,
resizable: true,
'autoHideMenuBar': true,
title: "PiBakery",
icon: 'app/img/icon.png'
});
var extraParams = process.argv.length > 1 ? process.argv[1] : "";
mainWindow.loadURL(path.normalize('file://' + __dirname + '/app/index.html?' + extraParams));
mainWindow.on('closed', function ()
{
electron.app.quit();
});
electronLocalshortcut.register(mainWindow, 'CommandOrControl+Shift+I', function()
{
mainWindow.toggleDevTools();
});
electronLocalshortcut.register(mainWindow, 'CommandOrControl+V', function()
{
mainWindow.webContents.send('paste', electron.clipboard.readText());
});
electronLocalshortcut.register(mainWindow, 'CommandOrControl+Shift+Plus', function()
{
mainWindow.webContents.send('testBlock');
});
});
});