Skip to content

Commit

Permalink
Vector.im client added
Browse files Browse the repository at this point in the history
  • Loading branch information
iskrisis committed Jul 25, 2016
1 parent f2b046b commit b863221
Show file tree
Hide file tree
Showing 185 changed files with 5,637 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Binary file added icons/alternative/icon.icns
Binary file not shown.
Binary file added icons/alternative/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 icons/icon.icns
Binary file not shown.
Binary file added icons/icon.ico
Binary file not shown.
Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions icons/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
210 changes: 210 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@

const electron = require('electron')
const open = require('open')
// Module to control application life.
const app = electron.app
const Menu = electron.Menu;

// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow


//Creating icon for the app. Not sure where used. Differes depending on platform.
const nativeImage = require('electron').nativeImage;
let image = nativeImage.createFromPath('file://${__dirname}/icon.png');


function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600, icon: image})

//Load main vector file
mainWindow.loadURL(`file://${__dirname}/vector/index.html`)

//Create app wide menu from template. Needed for shortcuts to work.
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);

//Hijack all _blank links to open in browser instead of electron window.
mainWindow.webContents.on('new-window', function(event, url){
event.preventDefault();
open(url);
});

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


}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})



// long menu template - could be separated
const template = [
{
label: 'Edit',
submenu: [
{
role: 'undo'
},
{
role: 'redo'
},
{
type: 'separator'
},
{
role: 'cut'
},
{
role: 'copy'
},
{
role: 'paste'
},
{
role: 'pasteandmatchstyle'
},
{
role: 'delete'
},
{
role: 'selectall'
},
]
},
{
label: 'View',
submenu: [
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click(item, focusedWindow) {
if (focusedWindow) focusedWindow.reload();
}
},
{
role: 'togglefullscreen'
},
{
label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click(item, focusedWindow) {
if (focusedWindow)
focusedWindow.webContents.toggleDevTools();
}
},
]
},
{
role: 'window',
submenu: [
{
role: 'minimize'
},
{
role: 'close'
},
]
},
{
role: 'help',
submenu: [
{
label: 'Learn More',
click() { require('electron').shell.openExternal('http://vector.im'); }
},
]
},
];

if (process.platform === 'darwin') {
const name = app.getName();
template.unshift({
label: name,
submenu: [
{
role: 'about'
},
{
type: 'separator'
},
{
role: 'services',
submenu: []
},
{
type: 'separator'
},
{
role: 'hide'
},
{
role: 'hideothers'
},
{
role: 'unhide'
},
{
type: 'separator'
},
{
role: 'quit'
},
]
});
// Window menu.
template[3].submenu = [
{
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close'
},
{
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
role: 'minimize'
},
{
label: 'Zoom',
role: 'zoom'
},
{
type: 'separator'
},
{
label: 'Bring All to Front',
role: 'front'
}
];
}



27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "vector-electron-desktop",
"version": "0.0.1",
"description": "Basic electron wrapper for Vector (http://vector.im) a messaging client that uses Matrix protocol (http://matrix.org/).",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"repository": {
"type": "git",
"url": "git+https://github.com/electron/electron-quick-start.git"
},
"author": "KRISIS",
"license": "CC0-1.0",
"bugs": {
"url": "https://github.com/electron/electron-quick-start/issues"
},
"homepage": "https://github.com/electron/electron-quick-start#readme",
"devDependencies": {
"devtron": "^1.2.1",
"electron-packager": "^7.3.0",
"electron-prebuilt": "^1.2.0"
},
"dependencies": {
"open": "0.0.5"
}
}
3 changes: 3 additions & 0 deletions renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
2 changes: 2 additions & 0 deletions vector/bundle.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions vector/bundle.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions vector/bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions vector/bundle.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit b863221

Please sign in to comment.