Added tray icon and click event for it
This commit is contained in:
parent
bf72600daa
commit
a48663a8d6
4 changed files with 13 additions and 7 deletions
|
@ -11,9 +11,10 @@
|
|||
"start": "node_modules/.bin/electron .",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "eslint -c node_modules/eslint-config/.eslintrc 'src/'",
|
||||
"build": "npm run create-build-dirs && npm run build-fonts && npm run build-html && npm run build-js && npm run build-less",
|
||||
"build": "npm run create-build-dirs && npm run build-fonts && npm run build-html && npm run build-img && npm run build-js && npm run build-less",
|
||||
"build-html": "cp src/index.html build/index.html && cp src/audio.html build/audio.html",
|
||||
"build-fonts": "cp -R node_modules/ionicons/fonts build/ && cp -R node_modules/bootstrap/fonts build/"
|
||||
"build-fonts": "cp -R node_modules/ionicons/fonts build/ && cp -R node_modules/bootstrap/fonts build/",
|
||||
"build-img": "cp -R src/img build/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
BIN
src/img/icon.png
Normal file
BIN
src/img/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 718 KiB |
|
@ -2,18 +2,22 @@ var React = require('react');
|
|||
var ipc = window.require('ipc');
|
||||
|
||||
var NavBar = React.createClass({
|
||||
handleClose: function (evt) {
|
||||
handleClose: function () {
|
||||
ipc.send('close');
|
||||
},
|
||||
|
||||
handleHide: function () {
|
||||
ipc.send('hide');
|
||||
},
|
||||
|
||||
render: function () {
|
||||
return (
|
||||
<nav id="navbar" className="navbar navbar-default navbar-fixed-top">
|
||||
<div className="container-fluid">
|
||||
<a className="navbar-brand">Keyboard Mechanizer</a>
|
||||
<ul className="nav navbar-nav navbar-right">
|
||||
<li><a href="#">Hide</a></li>
|
||||
<li><a href="#" onClick={this.handleClose}><i className="icon ion-close-round"></i></a></li>
|
||||
<li><a href="#" onClick={this.handleHide}>Hide</a></li>
|
||||
<li><a href="#" onClick={this.handleClose} alt="Close Program"><i className="icon ion-close-round"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -21,9 +21,10 @@ app.on('window-all-closed', function () {
|
|||
});
|
||||
|
||||
app.on('ready', function () {
|
||||
icon = new Tray(null);
|
||||
icon = new Tray(__dirname + '/img/icon.png');
|
||||
icon.setToolTip('Keyboard Mechanizer | Click to show');
|
||||
icon.on('click', function () {
|
||||
icon.on('clicked', function () {
|
||||
console.log("Icon Clicked");
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
|
|
Reference in a new issue