File tree Expand file tree Collapse file tree 4 files changed +38
-2
lines changed
Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ require('crash-reporter').start();
77var Menu = require ( 'menu' ) ;
88var Tray = require ( 'tray' ) ;
99var BrowserWindow = require ( 'browser-window' ) ;
10+ var AutoLaunch = require ( 'auto-launch' )
11+ , start = new AutoLaunch ( {
12+ name : 'Gitify' ,
13+ path : process . execPath . match ( / .* ?\. a p p / ) [ 0 ]
14+ } ) ;
1015
1116var iconIdle = path . join ( __dirname , 'images' , 'tray-idleTemplate.png' ) ;
1217var iconActive = path . join ( __dirname , 'images' , 'tray-active.png' ) ;
@@ -94,6 +99,14 @@ app.on('ready', function(){
9499 }
95100 } ) ;
96101
102+ ipc . on ( 'startup-enable' , function ( ) {
103+ start . enable ( ) ;
104+ } ) ;
105+
106+ ipc . on ( 'startup-disable' , function ( ) {
107+ start . disable ( ) ;
108+ } ) ;
109+
97110 ipc . on ( 'app-quit' , function ( ) {
98111 app . quit ( ) ;
99112 } ) ;
Original file line number Diff line number Diff line change 120120 },
121121 "homepage" : " https://github.com/ekonstantinidis/gitify" ,
122122 "dependencies" : {
123+ "auto-launch" : " ^0.1.18" ,
123124 "bootstrap" : " =3.3.4" ,
124125 "browserify" : " =10.2.1" ,
125126 "font-awesome" : " =4.3.0" ,
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ var SettingsPage = React.createClass({
1212 return {
1313 participating : settings . participating ,
1414 playSound : settings . playSound ,
15- showNotifications : settings . showNotifications
15+ showNotifications : settings . showNotifications ,
16+ openAtStartup : settings . openAtStartup
1617 } ;
1718 } ,
1819
@@ -51,6 +52,14 @@ var SettingsPage = React.createClass({
5152 onChange = { this . toggleSetting . bind ( this , 'showNotifications' ) } />
5253 </ div >
5354 </ div >
55+ < div className = 'row' >
56+ < div className = 'col-xs-8' > Open at startup</ div >
57+ < div className = 'col-xs-4' >
58+ < Toggle
59+ defaultChecked = { this . state . openAtStartup }
60+ onChange = { this . toggleSetting . bind ( this , 'openAtStartup' ) } />
61+ </ div >
62+ </ div >
5463 < div className = 'row' >
5564 < button
5665 className = 'btn btn-block btn-danger btn-close'
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ var SettingsStore = Reflux.createStore({
1111 settings = {
1212 participating : false ,
1313 playSound : true ,
14- showNotifications : true
14+ showNotifications : true ,
15+ openAtStartup : false
1516 } ;
1617 }
1718
@@ -28,6 +29,9 @@ var SettingsStore = Reflux.createStore({
2829 if ( ! settings . showNotifications ) {
2930 settings . showNotifications = true ;
3031 }
32+ if ( ! settings . openAtStartup ) {
33+ settings . openAtStartup = false ;
34+ }
3135
3236 this . _settings = settings ;
3337 window . localStorage . setItem ( 'settings' , JSON . stringify ( this . _settings ) ) ;
@@ -41,6 +45,15 @@ var SettingsStore = Reflux.createStore({
4145 this . _settings [ setting ] = value ;
4246 window . localStorage . setItem ( 'settings' , JSON . stringify ( this . _settings ) ) ;
4347 this . trigger ( this . _settings ) ;
48+ if ( setting == 'openAtStartup' ) {
49+ this . handleStartup ( value ) ;
50+ }
51+ } ,
52+
53+ handleStartup : function ( value ) {
54+ var ipc = window . require ( 'ipc' ) ;
55+ var method = ( value ) ? 'startup-enable' : 'startup-disable' ;
56+ ipc . send ( method ) ;
4457 }
4558
4659} ) ;
You can’t perform that action at this time.
0 commit comments