Switch to yarn and ready the app for production

This commit is contained in:
Alice Gaudon 2020-01-03 13:01:50 +01:00
parent 4d536eb43f
commit 1c945690de
6 changed files with 2067 additions and 1217 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
/.idea
node_modules/
/config
/config
/dist

1210
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,40 @@
{
"name": "browser-views",
"version": "1.0.0",
"name": "tabs",
"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",
"scripts": {
"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": {
"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"
}
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Arisu Views</title>
<title>Tabs</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">

View File

@ -2,7 +2,10 @@ const {
app,
BrowserWindow,
ipcMain,
Tray,
Menu,
} = require('electron');
const fs = require('fs');
const path = require('path');
const Config = require('./Config');
@ -10,12 +13,36 @@ const resourcesDir = path.resolve(__dirname, '../resources');
const config = new Config();
const devMode = process.argv.length > 2 && process.argv[2] === '--dev';
let selectedService = 0;
let tray;
let window;
let addServiceWindow;
function toggleMainWindow() {
if (window != null) {
if (!window.isFocused()) {
window.show();
} else {
window.hide();
}
}
}
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.
window = new BrowserWindow({
webPreferences: {
@ -30,7 +57,7 @@ function createWindow() {
window = null;
});
if (process.argv.length > 2 && process.argv[2] === '--dev') {
if (devMode) {
window.webContents.openDevTools({
mode: 'right'
});
@ -59,6 +86,11 @@ function createWindow() {
ipcMain.on('openAddServiceWindow', () => {
if (!addServiceWindow) {
addServiceWindow = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
webviewTag: true,
},
parent: window,
modal: true,
autoHideMenuBar: true,
@ -66,6 +98,11 @@ function createWindow() {
addServiceWindow.on('close', () => {
addServiceWindow = null;
});
if (devMode) {
addServiceWindow.webContents.openDevTools({
mode: 'right'
});
}
addServiceWindow.loadFile(path.resolve(resourcesDir, 'add-service.html'))
.catch(console.error);
}

1994
yarn.lock Normal file

File diff suppressed because it is too large Load Diff