Skip to content

Commit

Permalink
Do not use asar since this doesn't work with open which leverages the…
Browse files Browse the repository at this point in the history
… exec call
  • Loading branch information
ivelkov committed Feb 15, 2017
1 parent 07b09ab commit 981ea0d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 22 deletions.
50 changes: 32 additions & 18 deletions app/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const open = require('open');

const Tray = electron.Tray;
const Menu = electron.Menu;
let shouldQuit = false;

const app = electron.app;
app.on('ready', () => {
Expand All @@ -32,30 +33,43 @@ app.on('ready', () => {
window.focus();
}
});
tray.setContextMenu(new Menu.buildFromTemplate([
{
label: 'Open',
click: () => {
window.show();
tray.setContextMenu(new Menu.buildFromTemplate(
[
{
label: 'Refresh',
click: () => {
window.show();
window.reload();
}
},
{
label: 'Quit',
click: () => {
shouldQuit = true;
app.quit();
}
}
},
{
label: 'Refresh',
click: () => {
window.show();
window.reload();
}
},
{
label: 'Quit',
click: app.quit
]
));

window.on('close', (event) => {
if (!shouldQuit) {
event.preventDefault();
window.hide();
} else {
app.quit();
}
]));
});

window.webContents.on('new-window', (event, url) => {
event.preventDefault();
open(url);
open(url, (err, stdout, stderr) => {
if (err) {
console.error(`exec error: ${err}`);
}
});
});

window.webContents.setUserAgent('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36');
window.loadURL('https://teams.microsoft.com/');
});
5 changes: 4 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"version": "0.0.2",
"description": "Microsoft Teams for Linux",
"main": "lib/index.js",
"author": "Ivelin Velkov <[email protected]>"
"author": "Ivelin Velkov <[email protected]>",
"dependencies": {
"open": "0.0.5"
}
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"build": {
"appId": "teams-for-linux",
"asar": false,
"linux": {
"category": "Network",
"executableName": "teams",
Expand All @@ -34,7 +35,5 @@
]
}
},
"dependencies": {
"open": "0.0.5"
}
"dependencies": {}
}

0 comments on commit 981ea0d

Please sign in to comment.