Skip to content

Commit

Permalink
Changed icon to red while sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
noonat committed Nov 6, 2015
1 parent 59c96ef commit b48a920
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app.js
Expand Up @@ -33,6 +33,7 @@ peerConnection.on('connected', function connected (newPeer, remote) {
peer = newPeer

if (!remote) {
ipc.send('icon', 'connected')
ui.show(ui.containers.sharing)
ui.hide(ui.containers.content)
} else {
Expand All @@ -41,12 +42,14 @@ peerConnection.on('connected', function connected (newPeer, remote) {
}

peer.on('error', function error (err) {
ipc.send('icon', 'disconnected')
console.error('peer error')
console.error(err)
ui.containers.content.innerHTML = 'Error connecting! Please Quit. ' + err.message
})

peer.on('close', function close () {
ipc.send('icon', 'disconnected')
showChoose()
})
})
Expand Down
11 changes: 10 additions & 1 deletion electron.js
Expand Up @@ -3,11 +3,16 @@ var menubar = require('menubar')
var BrowserWindow = require('browser-window')
var ipc = require('ipc')

var icons = {
connected: path.join(__dirname, 'img', 'IconRed.png'),
disconnected: path.join(__dirname, 'img', 'Icon.png')
}

var mb = menubar({
width: 700,
height: 300,
index: 'file://' + path.join(__dirname, 'app.html'),
icon: 'file://' + path.join(__dirname, 'img', 'Icon.png')
icon: 'file://' + icons.disconnected
})

var win
Expand All @@ -18,6 +23,10 @@ mb.on('ready', function ready () {
console.log('ready')
})

ipc.on('icon', function (ev, key) {
mb.tray.setImage(icons[key])
})

mb.app.on('open-url', function (e, lnk) {
e.preventDefault()
if (mb.window) mb.window.webContents.send('open-url', lnk)
Expand Down
Binary file added img/IconRed.icns
Binary file not shown.
Binary file added img/IconRed.png
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/IconRed@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b48a920

Please sign in to comment.