Switch to yarn and ready the app for production
This commit is contained in:
parent
4d536eb43f
commit
1c945690de
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
/.idea
|
/.idea
|
||||||
node_modules/
|
node_modules/
|
||||||
/config
|
/config
|
||||||
|
/dist
|
1210
package-lock.json
generated
1210
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
@ -1,12 +1,40 @@
|
|||||||
{
|
{
|
||||||
"name": "browser-views",
|
"name": "tabs",
|
||||||
"version": "1.0.0",
|
"version": "0.0.1",
|
||||||
|
"description": "Persistent and separate browser tabs in one window",
|
||||||
|
"author": {
|
||||||
|
"name": "Alice Gaudon",
|
||||||
|
"email": "alice@gaudon.pro"
|
||||||
|
},
|
||||||
|
"homepage": "https://gitlab.com/ArisuOngaku/tabs",
|
||||||
|
"license": "MIT",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"dev": "electron . --dev"
|
"dev": "electron . --dev",
|
||||||
|
"build": "electron-builder",
|
||||||
|
"build-arch": "electron-builder --linux dir",
|
||||||
|
"pack": "electron-builder --dir",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^5.0.1"
|
"electron": "^6.0.10",
|
||||||
|
"electron-builder": "^21.2.0"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"appId": "tabs",
|
||||||
|
"linux": {
|
||||||
|
"target": [
|
||||||
|
"dir"
|
||||||
|
],
|
||||||
|
"executableName": "tabs",
|
||||||
|
"category": "Utility",
|
||||||
|
"desktop": {
|
||||||
|
"StartupWMClass": "Tabs",
|
||||||
|
"MimeType": "x-scheme-handler/tabs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"electronDist": "/usr/lib/electron",
|
||||||
|
"electronVersion": "6.0.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Arisu Views</title>
|
<title>Tabs</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
|
||||||
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
|
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
|
||||||
|
39
src/main.js
39
src/main.js
@ -2,7 +2,10 @@ const {
|
|||||||
app,
|
app,
|
||||||
BrowserWindow,
|
BrowserWindow,
|
||||||
ipcMain,
|
ipcMain,
|
||||||
|
Tray,
|
||||||
|
Menu,
|
||||||
} = require('electron');
|
} = require('electron');
|
||||||
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Config = require('./Config');
|
const Config = require('./Config');
|
||||||
|
|
||||||
@ -10,12 +13,36 @@ const resourcesDir = path.resolve(__dirname, '../resources');
|
|||||||
|
|
||||||
const config = new Config();
|
const config = new Config();
|
||||||
|
|
||||||
|
const devMode = process.argv.length > 2 && process.argv[2] === '--dev';
|
||||||
|
|
||||||
let selectedService = 0;
|
let selectedService = 0;
|
||||||
|
|
||||||
|
let tray;
|
||||||
let window;
|
let window;
|
||||||
let addServiceWindow;
|
let addServiceWindow;
|
||||||
|
|
||||||
|
function toggleMainWindow() {
|
||||||
|
if (window != null) {
|
||||||
|
if (!window.isFocused()) {
|
||||||
|
window.show();
|
||||||
|
} else {
|
||||||
|
window.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
|
// System tray
|
||||||
|
tray = new Tray(path.resolve(resourcesDir, 'logo.png'));
|
||||||
|
tray.setToolTip('Tabs');
|
||||||
|
tray.setContextMenu(Menu.buildFromTemplate([
|
||||||
|
{label: 'Tabs', enabled: false},
|
||||||
|
{label: 'Open Tabs', click: () => window.show()},
|
||||||
|
{type: 'separator'},
|
||||||
|
{label: 'Quit', role: 'quit'}
|
||||||
|
]));
|
||||||
|
tray.on('click', () => toggleMainWindow());
|
||||||
|
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
window = new BrowserWindow({
|
window = new BrowserWindow({
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
@ -30,7 +57,7 @@ function createWindow() {
|
|||||||
window = null;
|
window = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (process.argv.length > 2 && process.argv[2] === '--dev') {
|
if (devMode) {
|
||||||
window.webContents.openDevTools({
|
window.webContents.openDevTools({
|
||||||
mode: 'right'
|
mode: 'right'
|
||||||
});
|
});
|
||||||
@ -59,6 +86,11 @@ function createWindow() {
|
|||||||
ipcMain.on('openAddServiceWindow', () => {
|
ipcMain.on('openAddServiceWindow', () => {
|
||||||
if (!addServiceWindow) {
|
if (!addServiceWindow) {
|
||||||
addServiceWindow = new BrowserWindow({
|
addServiceWindow = new BrowserWindow({
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
enableRemoteModule: true,
|
||||||
|
webviewTag: true,
|
||||||
|
},
|
||||||
parent: window,
|
parent: window,
|
||||||
modal: true,
|
modal: true,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
@ -66,6 +98,11 @@ function createWindow() {
|
|||||||
addServiceWindow.on('close', () => {
|
addServiceWindow.on('close', () => {
|
||||||
addServiceWindow = null;
|
addServiceWindow = null;
|
||||||
});
|
});
|
||||||
|
if (devMode) {
|
||||||
|
addServiceWindow.webContents.openDevTools({
|
||||||
|
mode: 'right'
|
||||||
|
});
|
||||||
|
}
|
||||||
addServiceWindow.loadFile(path.resolve(resourcesDir, 'add-service.html'))
|
addServiceWindow.loadFile(path.resolve(resourcesDir, 'add-service.html'))
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user