Skip to content

Commit

Permalink
Created basic app
Browse files Browse the repository at this point in the history
  • Loading branch information
GyozaGuy committed Jun 29, 2018
0 parents commit b1897a6
Show file tree
Hide file tree
Showing 10 changed files with 2,782 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
"rules": {
"indent": [
"error",
2,
{
"SwitchCase": 1
}
],
"no-console": [
"warn",
{
"allow": [
"error",
"info",
"warn"
]
}
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Android Messages

By GyozaGuy

## Description

A basic Electron app that wraps [messages.android.com](https://messages.android.com).

## Icon

["message"](https://thenounproject.com/term/message/849833)
by Gregor Cresnar from the Noun Project.
Binary file added img/appicon-tray.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 img/appicon.icns
Binary file not shown.
Binary file added img/appicon.ico
Binary file not shown.
Binary file added img/appicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const {app, BrowserWindow, Menu, Tray} = require('electron');
require('electron-reload')(__dirname);

let win;

function createTray() {
const contextMenu = Menu.buildFromTemplate([
{label: 'Quit', click: () => app.quit()}
]);
const tray = new Tray(__dirname + '/img/appicon-tray.png');

tray.setToolTip('Messages');
tray.setContextMenu(contextMenu);

tray.on('click', () => {
if (!win) {
createWindow();
} else if (win.isVisible()) {
if (win.isFocused()) {
win.hide();
} else {
win.focus();
}
} else {
win.show();
}
});

tray.on('right-click', () => {
tray.popUpContextMenu(contextMenu);
});
}

function createWindow(cb) {
win = new BrowserWindow({height: 700, show: false, width: 1000});

win.loadURL('https://messages.android.com');

win.once('ready-to-show', () => {
win.show();

if (cb && typeof cb === 'function') {
cb();
}
});

win.on('close', () => {
// e.preventDefault();
// win.hide();
win = null;
});

// win.openDevTools();
}

app.on('activate', () => {
if (!win) {
createWindow();
} else {
win.show();
}
});

app.on('ready', () => {
createWindow(() => {
if (process.platform !== 'darwin') {
createTray();
}
});
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
Loading

0 comments on commit b1897a6

Please sign in to comment.