Skip to content

Commit 09469e4

Browse files
committed
Show a half-opacity icon when the proxy isn't active
1 parent ea45fdb commit 09469e4

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

IconSubduedTemplate.png

1.49 KB
Loading

IconSubduedTemplate@2x.png

2.26 KB
Loading

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ let menubar = require('menubar');
1919

2020
let server;
2121

22+
const icons = {
23+
active: app.getAppPath() + '/IconTemplate.png',
24+
subdued: app.getAppPath() + '/IconSubduedTemplate.png'
25+
}
26+
2227
let mb = menubar({
2328
preloadWindow: true,
2429
width: 400,
2530
height: 180,
26-
icon: app.getAppPath() + '/IconTemplate.png'
31+
icon: icons.subdued
2732
});
2833

2934
mb.on('ready', function ready () {
@@ -42,13 +47,15 @@ ipc.on('connect', function(event) {
4247
ipc.on('start-proxy', function(event, port) {
4348
server = setup(http.createServer());
4449
server.listen(port, function() {
50+
mb.tray.setImage(icons.active);
4551
var port = server.address().port;
4652
console.log('HTTP(s) proxy server listening on port %d', port);
4753
});
4854
});
4955

5056
ipc.on('stop-proxy', function(event, port) {
5157
server.close(function() {
58+
mb.tray.setImage(icons.subdued);
5259
console.log('proxy stopped')
5360
});
5461
});

0 commit comments

Comments
 (0)