Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit
Browse files Browse the repository at this point in the history
1000ch committed Nov 22, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
0 parents commit 16e40f9
Showing 18 changed files with 417 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
*.log
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sudo: false
language: node_js
node_js:
- 6
notifications:
email: false
Binary file added asset/quail.sketch
Binary file not shown.
19 changes: 19 additions & 0 deletions browser.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.navbar {
-webkit-app-region: drag;
}

.navbar-main {
padding-top: 25px;
-webkit-app-region: drag;
}

.navbar-sub {
-webkit-app-region: drag;
}

@media (max-width: 900px) {
.navbar-main {
padding-top: 0;
padding-left: 80px;
}
}
Empty file added browser.js
Empty file.
11 changes: 11 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const Config = require('electron-config');

module.exports = new Config({
defaults: {
zoomFactor: 1,
lastWindowState: {
width: 840,
height: 840
}
}
});
Binary file added demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
'use strict';
const path = require('path');
const fs = require('fs');
const electron = require('electron');
const appMenu = require('./menu');
const tray = require('./tray');
const config = require('./config');

const app = electron.app;

require('electron-debug')();
require('electron-dl')();
require('electron-context-menu')();

let mainWindow;
let isQuitting = false;

const isAlreadyRunning = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}

mainWindow.show();
}
});

if (isAlreadyRunning) {
app.quit();
}

function createMainWindow() {
const lastWindowState = config.get('lastWindowState');
const maxWindowInteger = 2147483647; // used to set max window width/height when toggling fullscreen

const win = new electron.BrowserWindow({
title: app.getName(),
show: false,
x: lastWindowState.x,
y: lastWindowState.y,
width: lastWindowState.width,
height: lastWindowState.height,
icon: process.platform === 'linux' && path.join(__dirname, 'static/Icon.png'),
minWidth: 480,
minHeight: 480,
titleBarStyle: 'hidden-inset',
autoHideMenuBar: true,
backgroundColor: '#fff',
webPreferences: {
preload: path.join(__dirname, 'browser.js'),
nodeIntegration: false,
plugins: true
}
});

if (process.platform === 'darwin') {
win.setSheetOffset(40);
}

win.loadURL('https://esa.io/');

win.on('close', e => {
if (!isQuitting) {
e.preventDefault();

if (process.platform === 'darwin') {
app.hide();
} else {
win.hide();
}
}
});

win.on('page-title-updated', e => {
e.preventDefault();
});

win.on('enter-full-screen', () => {
win.setMaximumSize(maxWindowInteger, maxWindowInteger);
});

return win;
}

app.on('ready', () => {
electron.Menu.setApplicationMenu(appMenu);
mainWindow = createMainWindow();
tray.create(mainWindow);

const page = mainWindow.webContents;

page.on('dom-ready', () => {
page.insertCSS(fs.readFileSync(path.join(__dirname, 'browser.css'), 'utf8'));
mainWindow.show();
});

page.on('new-window', (e, url) => {
e.preventDefault();
electron.shell.openExternal(url);
});
});

app.on('activate', () => {
mainWindow.show();
});

app.on('before-quit', () => {
isQuitting = true;

if (!mainWindow.isFullScreen()) {
config.set('lastWindowState', mainWindow.getBounds());
}
});
144 changes: 144 additions & 0 deletions menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
'use strict';
const os = require('os');
const path = require('path');
const electron = require('electron');

const app = electron.app;
const shell = electron.shell;
const appName = app.getName();

const helpSubmenu = [{
label: `${appName} Website`,
click() {
shell.openExternal('https://github.com/1000ch/quail');
}
}, {
label: 'Report an Issue...',
click() {
const body = `
<!-- Please succinctly describe your issue and steps to reproduce it. -->
-
${app.getName()} ${app.getVersion()}
Electron ${process.versions.electron}
${process.platform} ${process.arch} ${os.release()}`;

shell.openExternal(`https://github.com/1000ch/quail/issues/new?body=${encodeURIComponent(body)}`);
}
}];

if (process.platform !== 'darwin') {
helpSubmenu.push({
type: 'separator'
}, {
role: 'about',
click() {
electron.dialog.showMessageBox({
title: `About ${appName}`,
message: `${appName} ${app.getVersion()}`,
detail: 'Created by Shogo Sensui',
icon: path.join(__dirname, 'static/Icon.png'),
buttons: []
});
}
});
}

const darwinTpl = [{
label: appName,
submenu: [{
role: 'about'
}, {
type: 'separator'
}, {
role: 'services',
submenu: []
}, {
type: 'separator'
}, {
role: 'hide'
}, {
role: 'hideothers'
}, {
role: 'unhide'
}, {
type: 'separator'
}, {
role: 'quit'
}]
}, {
label: 'Edit',
submenu: [{
role: 'undo'
}, {
role: 'redo'
}, {
type: 'separator'
}, {
role: 'cut'
}, {
role: 'copy'
}, {
role: 'paste'
}, {
role: 'pasteandmatchstyle'
}, {
role: 'delete'
}, {
role: 'selectall'
}]
}, {
role: 'window',
submenu: [{
role: 'minimize'
}, {
role: 'close'
}, {
type: 'separator'
}, {
type: 'separator'
}, {
role: 'front'
}, {
role: 'togglefullscreen'
}]
}, {
role: 'help',
submenu: helpSubmenu
}];

const otherTpl = [{
label: 'File',
submenu: [{
role: 'quit'
}]
}, {
label: 'Edit',
submenu: [{
role: 'undo'
}, {
role: 'redo'
}, {
type: 'separator'
}, {
role: 'cut'
}, {
role: 'copy'
}, {
role: 'paste'
}, {
role: 'pasteandmatchstyle'
}, {
role: 'delete'
}, {
type: 'separator'
}, {
role: 'selectall'
}]
}, {
role: 'help',
submenu: helpSubmenu
}];

const tpl = process.platform === 'darwin' ? darwinTpl : otherTpl;

module.exports = electron.Menu.buildFromTemplate(tpl);
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "quail",
"productName": "Quail",
"version": "0.1.0",
"description": "Quail app",
"license": "MIT",
"repository": "1000ch/quail",
"author": {
"name": "Shogo Sensui",
"email": "[email protected]",
"url": "github.com/1000ch"
},
"scripts": {
"test": "xo",
"start": "electron .",
"build": "npm run build:macos && npm run build:linux && npm run build:windows",
"build:macos": "electron-packager . --overwrite --asar --out=dist --ignore='^media$' --platform=darwin --arch=x64 --icon=static/Icon.icns --app-bundle-id=net.1000ch.quail --sign='Developer ID Application: Shogo Sensui (NZR22QGKNQ)' && cd dist/Quail-darwin-x64 && zip -ryXq9 ../Quail-macos-${npm_package_version}.zip Quail.app",
"build:linux": "electron-packager . --overwrite --out=dist --ignore='^media$' --platform=linux --arch=x64 --app-bundle-id=net.1000ch.quail && cd dist/Quail-linux-x64/ && zip -ryq9 ../Quail-linux-${npm_package_version}.zip *",
"build:windows": "electron-packager . --overwrite --asar --out=dist --ignore='^media$' --platform=win32 --arch=ia32 --icon=static/Icon.ico --version-string.ProductName=$npm_package_productName && cd dist/Quail-win32-ia32 && zip -ryq9 ../Quail-windows-${npm_package_version}.zip *"
},
"dependencies": {
"electron-config": "^0.2.1",
"electron-context-menu": "^0.7.0",
"electron-debug": "^1.0.0",
"electron-dl": "^1.0.0",
"element-ready": "^0.2.0"
},
"devDependencies": {
"electron": "^1.4.0",
"electron-packager": "^8.0.0",
"xo": "*"
},
"xo": {
"esnext": true,
"space": 2,
"envs": [
"node",
"browser"
]
}
}
27 changes: 27 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Quail

Unofficial [esa](https://esa.io/) app

[![Build Status](https://travis-ci.org/1000ch/quail.svg?branch=master)](https://travis-ci.org/1000ch/quail)

![Quail demo](demo.png)

## Install

macOS 10.9+ & Linux are supported.

### macOS

[Download](https://github.com/1000ch/quail/releases) and extract `.zip`, and move `Quail.app` to `/Applications`.

### Windows

Coming soon.

### Linux

[Download](https://github.com/1000ch/quail/releases) and extract `.zip`, and move `Quail.app` to somewhere.

## License

MIT: http://1000ch.mit-license.org
Binary file added static/Icon.icns
Binary file not shown.
Binary file added static/Icon.ico
Binary file not shown.
Binary file added static/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/IconTray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 16e40f9

Please sign in to comment.