-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7969331
Showing
12 changed files
with
342 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"presets": [ | ||
"es2015", | ||
"stage-0" | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
npm-debug.log | ||
node_modules/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- "4" | ||
- "5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Tim Cheung | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# <img src=".github/gmail-logo.png" width="45"> Gmail Desktop | ||
|
||
[](http://standardjs.com/) | ||
|
||
> An unofficial Gmail Desktop App built with [Electron](https://github.com/electron/electron) | ||
 | ||
|
||
**Features:** | ||
- Native Notifications | ||
- Unread Count Badge (OS X only) | ||
|
||
**Supported OS:** | ||
- [x] OS X 10.9+ | ||
- [ ] Windows 7+ | ||
- [ ] Linux | ||
|
||
## Installation | ||
|
||
#### OS X | ||
1. [Download latest release](https://github.com/timche/gmail-desktop/releases). | ||
1. Unzip it. | ||
1. Move `Gmail Desktop.app` to `/Applications`. | ||
|
||
## Development | ||
Gmail Desktop is built with [Electron](https://github.com/electron/electron). | ||
|
||
1. **Clone this repository:** | ||
|
||
```bash | ||
$ git clone [email protected]:timche/gmail-desktop.git | ||
$ cd gmail-desktop | ||
``` | ||
1. **Install npm dependencies:** | ||
|
||
```bash | ||
$ npm install | ||
``` | ||
|
||
#### Commands | ||
- **Run the app:** | ||
|
||
```bash | ||
$ npm start | ||
``` | ||
|
||
- **Lint:** | ||
|
||
```bash | ||
$ npm run lint | ||
``` | ||
|
||
- **Build OS X:** | ||
|
||
```bash | ||
$ npm run build:osx | ||
``` | ||
|
||
- **Build all platforms:** | ||
|
||
```bash | ||
$ npm run build | ||
``` | ||
|
||
## To-Do | ||
- [ ] Multi Gmail Accounts. | ||
- [ ] Adjust UI so OS X window buttons don't overlay Google Logo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { app, shell, BrowserWindow, Menu } from 'electron' | ||
import menu from './menu' | ||
|
||
let mainWindow | ||
let isQuitting = false | ||
|
||
let isAlreadyRunning = app.makeSingleInstance(() => { | ||
if (mainWindow) { | ||
if (mainWindow.isMinimized()) { | ||
mainWindow.restore() | ||
} | ||
|
||
mainWindow.show() | ||
} | ||
}) | ||
|
||
if (isAlreadyRunning) { | ||
app.quit() | ||
} | ||
|
||
function updateBadge (title) { | ||
let unreadCount = (/^.+\s\((\d+)\)/).exec(title) | ||
|
||
app.dock.setBadge(unreadCount ? unreadCount[1] : '') | ||
} | ||
|
||
function createWindow () { | ||
mainWindow = new BrowserWindow({ | ||
title: app.getName(), | ||
width: 1280, | ||
height: 960, | ||
titleBarStyle: 'hidden-inset' | ||
}) | ||
|
||
mainWindow.loadURL('https://mail.google.com') | ||
|
||
mainWindow.on('close', (e) => { | ||
if (!isQuitting) { | ||
e.preventDefault() | ||
|
||
if (process.platform === 'darwin') { | ||
app.hide() | ||
} else { | ||
win.hide() | ||
} | ||
} | ||
}) | ||
|
||
mainWindow.on('page-title-updated', (e, title) => updateBadge(title)) | ||
} | ||
|
||
app.on('ready', () => { | ||
createWindow() | ||
|
||
Menu.setApplicationMenu(menu) | ||
|
||
let {webContents} = mainWindow | ||
|
||
webContents.on('dom-ready', () => { | ||
mainWindow.show() | ||
}) | ||
|
||
webContents.on('new-window', (e, url) => { | ||
if (!/^.*(mail\.google\.com).*/.test(url)) { | ||
e.preventDefault() | ||
shell.openExternal(url) | ||
} | ||
}) | ||
}) | ||
|
||
app.on('activate', function () { | ||
mainWindow.show() | ||
}) | ||
|
||
app.on('before-quit', () => { | ||
isQuitting = true | ||
}) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('babel-core/register') | ||
require('./app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import { app, shell, Menu } from 'electron' | ||
|
||
const APP_NAME = app.getName() | ||
|
||
let darwinMenu = [ | ||
{ | ||
label: APP_NAME, | ||
submenu: [ | ||
{ | ||
label: `About ${APP_NAME}`, | ||
role: 'about', | ||
}, | ||
{ | ||
label: `Hide ${APP_NAME}`, | ||
accelerator: 'Cmd+H', | ||
role: 'hide' | ||
}, | ||
{ | ||
label: 'Hide others', | ||
accelerator: 'Cmd+Shift+H', | ||
role: 'hideothers' | ||
}, | ||
{ | ||
label: 'Show All', | ||
role: 'unhide' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: `Quit ${APP_NAME}`, | ||
accelerator: 'Cmd+Q', | ||
click() { | ||
app.quit() | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Edit', | ||
submenu: [ | ||
{ | ||
label: 'Undo Typing', | ||
accelerator: 'Cmd+Z', | ||
role: 'undo' | ||
}, | ||
{ | ||
label: 'Redo', | ||
accelerator: 'Shift+Cmd+Z', | ||
role: 'redo' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Cut', | ||
accelerator: 'Cmd+X', | ||
role: 'cut' | ||
}, | ||
{ | ||
label: 'Copy', | ||
accelerator: 'Cmd+C', | ||
role: 'copy' | ||
}, | ||
{ | ||
label: 'Paste', | ||
accelerator: 'Cmd+V', | ||
role: 'paste' | ||
}, | ||
{ | ||
label: 'Select All', | ||
accelerator: 'Cmd+A', | ||
role: 'selectall' | ||
}, | ||
] | ||
}, | ||
{ | ||
label: 'Window', | ||
role: 'window', | ||
submenu: [ | ||
{ | ||
label: 'Minimize', | ||
accelerator: 'Cmd+M', | ||
role: 'minimize' | ||
}, | ||
{ | ||
label: 'Close', | ||
accelerator: 'Cmd+W', | ||
role: 'close' | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Help', | ||
role: 'help', | ||
submenu: [ | ||
{ | ||
label: `${APP_NAME} Website`, | ||
click() { | ||
shell.openExternal('https://github.com/timche/gmail-desktop') | ||
} | ||
}, | ||
{ | ||
label: 'Report an issue', | ||
click() { | ||
shell.openExternal('https://github.com/timche/gmail-desktop/issues/new') | ||
} | ||
} | ||
] | ||
} | ||
] | ||
|
||
export default Menu.buildFromTemplate(darwinMenu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "gmail-desktop", | ||
"productName": "Gmail Desktop", | ||
"version": "0.1.0", | ||
"description": "An unofficial Gmail Desktop App built with Electron", | ||
"main": "index.js", | ||
"scripts": { | ||
"clean": "rimraf build/", | ||
"lint": "standard --verbose | snazzy", | ||
"test": "npm run lint", | ||
"start": "electron .", | ||
"build:osx": "electron-packager . --out=build --overwrite --platform=darwin --arch=x64 --icon=assets/icons/icon.icns --app-version=$npm_package_version", | ||
"build": "npm run clean && npm run build:osx" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/timche/gmail-desktop.git" | ||
}, | ||
"keywords": [ | ||
"gmail", | ||
"google", | ||
"mail", | ||
"desktop", | ||
"app", | ||
"client", | ||
"osx", | ||
"windows", | ||
"linux", | ||
"electron" | ||
], | ||
"author": "timche", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/timche/gmail-desktop/issues" | ||
}, | ||
"homepage": "https://github.com/timche/gmail-desktop#readme", | ||
"devDependencies": { | ||
"babel-core": "^6.7.7", | ||
"babel-eslint": "^6.0.3", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"electron-packager": "^7.0.1", | ||
"electron-prebuilt": "^0.37.7", | ||
"rimraf": "^2.5.2", | ||
"snazzy": "^3.0.1", | ||
"standard": "^6.0.8" | ||
} | ||
} |