Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
bcalik committed Jun 24, 2015
0 parents commit 35c4ff3
Show file tree
Hide file tree
Showing 9 changed files with 226 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
dist
node_modules/*
electron-*
160 changes: 160 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
var app = require('app'); // Module to control application life.
var Menu = require('menu');
var Tray = require('tray');
var BrowserWindow = require('browser-window'); // Module to create native browser window.
var mainWindow = null;
var appIcon = null;
var win = null;

var template = [
{
label: 'Whatsapp',
submenu: [
{
label: 'About Whatsapp',
selector: 'orderFrontStandardAboutPanel:'
},
{ type: 'separator' },
{
label: 'Hide Whatsapp',
accelerator: 'Command+H',
selector: 'hide:'
},
{
label: 'Hide Others',
accelerator: 'Command+Shift+H',
selector: 'hideOtherApplications:'
},
{
label: 'Show All',
selector: 'unhideAllApplications:'
},
{ type: 'separator' },
{
label: 'Quit',
accelerator: 'Command+Q',
selector: 'terminate:'
},
]
},
{
label: 'Edit',
submenu: [
{
label: 'Undo',
accelerator: 'Command+Z',
selector: 'undo:'
},
{
label: 'Redo',
accelerator: 'Shift+Command+Z',
selector: 'redo:'
},
{ type: 'separator' },
{
label: 'Cut',
accelerator: 'Command+X',
selector: 'cut:'
},
{
label: 'Copy',
accelerator: 'Command+C',
selector: 'copy:'
},
{
label: 'Paste',
accelerator: 'Command+V',
selector: 'paste:'
},
{
label: 'Select All',
accelerator: 'Command+A',
selector: 'selectAll:'
}
]
},
{
label: 'View',
submenu: [
{
label: 'Reload',
accelerator: 'Command+R',
click: function() { remote.getCurrentWindow().reload(); }
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+Command+I',
click: function() { remote.getCurrentWindow().toggleDevTools(); }
},
]
},
{
label: 'Window',
submenu: [
{
label: 'Minimize',
accelerator: 'Command+M',
selector: 'performMiniaturize:'
},
{
label: 'Close',
accelerator: 'Command+W',
selector: 'hide:'
},
{ type: 'separator' },
{
label: 'Bring All to Front',
selector: 'arrangeInFront:'
}
]
}
];

// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.quit();
});

// Initialization.
app.on('ready', function() {
// Configuration
appIcon = new Tray(__dirname+'/assets/trayTemplate.png');
appIcon.on("clicked", function(){
win.show();
});
appIcon.setToolTip('Whatsapp');

var menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);

// Create the browser window.
win = new BrowserWindow({
"width": 900,
"height": 720,
"type": "toolbar",
"title": "Whatsapp",
"node-integration": false,
});

// Load the app page
win.loadUrl('https://web.whatsapp.com', {
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.52 Safari/537.36'
});

// Open links externally
win.webContents.on("new-window", function(event, url, frameName, disposition){
require('shell').openExternal(url)
event.preventDefault();
});

// Open the devtools.
// win.openDevTools();

// Emitted when the window is closed.
win.on('closed', function() {
win = null;
});

// app.dock.hide();
win.show();
});
Binary file added app/assets/trayTemplate.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 app/assets/trayTemplate@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name" : "whatsapp",
"version" : "0.1.1",
"main" : "app.js"
}
Binary file added assets/osx/whatsapp.icns
Binary file not shown.
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "whatsapp-desktop",
"version": "0.1.1",
"description": "Unofficial Whatsapp Desktop Client. Build with Electron.",
"main": "app.js",
"scripts": {
"dev": "electron ./app",
"clean": "rm -rf ./dist",
"clean:osx": "rm -rf ./dist/osx",
"build": "npm run clean && npm run build:osx",
"build:osx": "npm run clean:osx && electron-packager ./app \"Whatsapp\" --out=dist/osx --platform=darwin --arch=x64 --version=0.28.3 --icon=assets/osx/whatsapp.icns",
"pack": "npm run pack:osx",
"pack:osx": "npm run build:osx && electron-builder \"dist/osx/Whatsapp.app\" --platform=osx --out=\"dist/osx\" --config=packager.json"
},
"devDependencies": {
"electron-packager": "^4.1.3",
"electron-prebuilt": "^0.28.3",
"electron-builder": "^2.0.0"
}
}
11 changes: 11 additions & 0 deletions packager.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"osx" : {
"title": "Whatsapp",
"icon": "assets/osx/whatsapp.icns",
"icon-size": 80,
"contents": [
{ "x": 438, "y": 344, "type": "link", "path": "/Applications" },
{ "x": 192, "y": 344, "type": "file" }
]
}
}
26 changes: 26 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Whatsapp Desktop

Whatsapp desktop client for OSX, based on the official whatsapp web app. Build with [Electron](http://electron.atom.io/).


This is **NOT** an official product. This project does not attempt to reverse engineer the WhatsApp API or attempt to reimplement any part of the WhatsApp client. Any communication between the user and WhatsApp servers is handled by official WhatsApp Web itself; this is just a native wrapper for WhatsApp Web, like a browser.

## Features

* Native notifications.
* System tray icon.
* Open links in browser.

**Planned features:**

* Badge with the number of notifications in the dock/taskbar.
* Auto-launch on OS startup.

## Contributions

Contributions are welcome! For feature requests and bug reports please submit an [issue](https://github.com/bcalik/whatsapp-desktop/issues).

## Build

`npm install`
`npm run build`

0 comments on commit 35c4ff3

Please sign in to comment.