Merge branch 'develop'

This commit is contained in:
Alice Gaudon 2020-06-15 16:00:01 +02:00
commit 49ba273927
9 changed files with 257 additions and 187 deletions

View File

@ -1,3 +1,7 @@
:root {
--nav-width: 48px;
}
body {
display: flex;
flex-direction: row;
@ -7,7 +11,7 @@ body {
display: flex;
flex-direction: column;
height: 100%;
width: 48px;
width: var(--nav-width);
}
#navigation > :not(#service-buttons) {
@ -53,7 +57,7 @@ body {
}
#service-selector .drag-target-self button::after {
height: 48px;
height: var(--nav-width);
border: 1px dashed #fff;
transform: none;
}
@ -76,8 +80,8 @@ body {
#navigation button {
position: relative;
display: block;
width: 48px;
height: 48px;
width: var(--nav-width);
height: var(--nav-width);
margin: 0;
padding: 0;
@ -94,11 +98,11 @@ body {
}
#navigation button img {
width: 24px;
width: calc(var(--nav-width) / 2);
}
#navigation button i {
font-size: 24px;
font-size: calc(var(--nav-width) / 2);
}
#service-selector li {
@ -152,11 +156,11 @@ body {
#history button,
#history .status {
display: inline;
width: 24px;
height: 24px;
width: calc(var(--nav-width) / 2);
height: calc(var(--nav-width) / 2);
margin: 2px;
padding: initial;
font-size: 12px;
font-size: calc(var(--nav-width) / 4);
background: #fff1;
@ -265,10 +269,22 @@ body {
height: 100%;
}
#services > :not(.active):not(.loader):not(#url-preview) {
#services > :not(.active):not(.loader):not(#url-preview):not(webview) {
display: none;
}
#services > webview {
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
background-color: rgb(43, 43, 43);
}
#services > webview.active {
z-index: 20;
}
#services > .loader {
width: 64px;
height: 64px;

View File

@ -27,8 +27,21 @@
<p id="current-version"></p>
<p id="update-status">Loading...</p>
<button id="download-button" type="button" class="hidden">Download</button>
</div>
</div>startMinimized
<section>
<h2 class="form-header">Startup</h2>
<label class="form-group"><input type="checkbox" name="start-minimized" id="start-minimized"> Start minimized in system tray</label>
</section>
<section>
<h2 class="form-header">Appearance</h2>
<label class="form-group"><input type="checkbox" name="big-nav-bar" id="big-nav-bar"> Increase the size of the navigation bar</label>
</section>
<section>
<h2 class="form-header">History navigation buttons</h2>
<label class="form-group">
@ -41,6 +54,7 @@
<input type="checkbox" name="forward-button" id="forward-button"> Go forward button</label>
<label class="form-group">
<input type="checkbox" name="refresh-button" id="refresh-button"> Refresh page button</label>
</section>
</div>
<div class="form-footer">

View File

@ -207,6 +207,9 @@ ipcRenderer.on('data', (event, appData, iconSets, actualSelectedService, emptyUr
// Other elements
serviceSelector = document.getElementById('service-selector');
// Navbar size
document.documentElement.style.setProperty('--nav-width', config.bigNavBar ? '64px' : '48px');
});
function removeServiceFeatures(id: number): HTMLElement | null {

View File

@ -6,6 +6,10 @@ let updateInfo: any;
let updateButton: HTMLElement | null;
let config: any;
let startMinimizedField: HTMLInputElement | null;
let bigNavBarField: HTMLInputElement | null;
let securityButtonField: HTMLInputElement | null,
homeButtonField: HTMLInputElement | null,
backButtonField: HTMLInputElement | null,
@ -18,6 +22,10 @@ ipcRenderer.on('current-version', (e, version) => {
ipcRenderer.on('config', (e, c) => {
config = c;
if (startMinimizedField) startMinimizedField.checked = config.startMinimized;
if (bigNavBarField) bigNavBarField.checked = config.bigNavBar;
if (securityButtonField) securityButtonField.checked = config.securityButton;
if (homeButtonField) homeButtonField.checked = config.homeButton;
if (backButtonField) backButtonField.checked = config.backButton;
@ -41,6 +49,10 @@ function save() {
if (!form) return;
const formData = new FormData(form);
config.startMinimized = formData.get('start-minimized') === 'on';
config.bigNavBar = formData.get('big-nav-bar') === 'on';
config.securityButton = formData.get('security-button') === 'on';
config.homeButton = formData.get('home-button') === 'on';
config.backButton = formData.get('back-button') === 'on';
@ -49,7 +61,7 @@ function save() {
ipcRenderer.send('save-config', config);
remote.getCurrentWindow().close();
};
}
document.addEventListener('DOMContentLoaded', () => {
currentVersion = document.getElementById('current-version');
@ -60,6 +72,10 @@ document.addEventListener('DOMContentLoaded', () => {
.catch(console.error);
});
startMinimizedField = <HTMLInputElement>document.getElementById('start-minimized');
bigNavBarField = <HTMLInputElement>document.getElementById('big-nav-bar');
securityButtonField = <HTMLInputElement>document.getElementById('security-button');
homeButtonField = <HTMLInputElement>document.getElementById('home-button');
backButtonField = <HTMLInputElement>document.getElementById('back-button');

View File

@ -1,6 +1,6 @@
{
"name": "tabs",
"version": "1.0.3",
"version": "1.1.0",
"description": "Persistent and separate browser tabs in one window.",
"author": {
"name": "Alice Gaudon",
@ -59,7 +59,7 @@
],
"linux": {
"target": "AppImage",
"icon": "resources/logo.png",
"icon": "resources/images/logo.png",
"category": "Utility",
"executableName": "tabs",
"desktop": {
@ -76,9 +76,9 @@
},
"win": {
"target": "nsis",
"icon": "resources/logo.png",
"icon": "resources/images/logo.png",
"publisherName": "Alice Gaudon",
"verifyUpdateCodeSignature": "true",
"verifyUpdateCodeSignature": "false",
"publish": [
{
"provider": "github",
@ -89,7 +89,7 @@
},
"mac": {
"target": "default",
"icon": "resources/logo.png",
"icon": "resources/images/logo.png",
"category": "public.app-category.utilities",
"publish": [
{

View File

@ -3,6 +3,7 @@ import Meta from "./Meta";
import Config from "./Config";
import Updater from "./Updater";
import MainWindow from "./windows/MainWindow";
import * as os from "os";
export default class Application {
private readonly devMode: boolean;
@ -14,7 +15,7 @@ export default class Application {
constructor(devMode: boolean) {
this.devMode = devMode;
this.config = new Config();
this.updater = new Updater(this.config);
this.updater = new Updater(this.config, this);
this.mainWindow = new MainWindow(this);
}
@ -26,9 +27,11 @@ export default class Application {
this.setupElectronTweaks();
// Check for updates
if (os.platform() === 'win32') {
this.updater.checkAndPromptForUpdates(this.mainWindow.getWindow()).then(() => {
console.log('Update check successful.');
}).catch(console.error);
}
console.log('App started');
}

View File

@ -10,7 +10,13 @@ const configFile = path.resolve(configDir, 'config.json');
export default class Config {
public services: Service[] = [];
public updateCheckSkip?: string;
public startMinimized: boolean = false;
public bigNavBar: boolean = false;
public securityButton: boolean = true;
public homeButton: boolean = false;
public backButton: boolean = true;
@ -44,6 +50,10 @@ export default class Config {
this.defineProperty('updateCheckSkip', data);
this.defineProperty('startMinimized', data);
this.defineProperty('bigNavBar', data);
this.defineProperty('securityButton', data);
this.defineProperty('homeButton', data);
this.defineProperty('backButton', data);

View File

@ -2,13 +2,16 @@ import {autoUpdater, UpdateInfo} from "electron-updater";
import {dialog, shell} from "electron";
import Config from "./Config";
import BrowserWindow = Electron.BrowserWindow;
import Application from "./Application";
export default class Updater {
private readonly config: Config;
private readonly application: Application;
private updateInfo?: UpdateInfo;
public constructor(config: Config) {
public constructor(config: Config, application: Application) {
this.config = config;
this.application = application;
// Configure auto updater
autoUpdater.autoDownload = false;
@ -42,10 +45,10 @@ export default class Updater {
if (updateInfo && updateInfo.version !== this.config.updateCheckSkip) {
const input = await dialog.showMessageBox(mainWindow, {
message: `Version ${updateInfo.version} of tabs is available. Do you wish to download this update?`,
message: `Version ${updateInfo.version} of tabs is available. Do you wish to install this update?`,
buttons: [
'Cancel',
'Download',
'Install',
],
checkboxChecked: false,
checkboxLabel: `Don't remind me for this version`,
@ -61,7 +64,9 @@ export default class Updater {
}
if (input.response === 1) {
await shell.openExternal(`https://github.com/ArisuOngaku/tabs/releases/download/v${updateInfo.version}/${updateInfo.path}`);
await this.application.stop();
await autoUpdater.downloadUpdate();
autoUpdater.quitAndInstall();
}
}
}

View File

@ -25,11 +25,14 @@ export default class MainWindow extends Window {
autoHideMenuBar: true,
icon: Meta.ICON_PATH,
title: Meta.title,
show: !this.application.getConfig().startMinimized,
});
const window = this.getWindow();
if (!this.application.getConfig().startMinimized) {
window.maximize();
}
if (this.application.isDevMode()) {
window.webContents.openDevTools({