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();
7
7
var Menu = require ( 'menu' ) ;
8
8
var Tray = require ( 'tray' ) ;
9
9
var 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
+ } ) ;
10
15
11
16
var iconIdle = path . join ( __dirname , 'images' , 'tray-idleTemplate.png' ) ;
12
17
var iconActive = path . join ( __dirname , 'images' , 'tray-active.png' ) ;
@@ -94,6 +99,14 @@ app.on('ready', function(){
94
99
}
95
100
} ) ;
96
101
102
+ ipc . on ( 'startup-enable' , function ( ) {
103
+ start . enable ( ) ;
104
+ } ) ;
105
+
106
+ ipc . on ( 'startup-disable' , function ( ) {
107
+ start . disable ( ) ;
108
+ } ) ;
109
+
97
110
ipc . on ( 'app-quit' , function ( ) {
98
111
app . quit ( ) ;
99
112
} ) ;
Original file line number Diff line number Diff line change 120
120
},
121
121
"homepage" : " https://github.com/ekonstantinidis/gitify" ,
122
122
"dependencies" : {
123
+ "auto-launch" : " ^0.1.18" ,
123
124
"bootstrap" : " =3.3.4" ,
124
125
"browserify" : " =10.2.1" ,
125
126
"font-awesome" : " =4.3.0" ,
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ var SettingsPage = React.createClass({
12
12
return {
13
13
participating : settings . participating ,
14
14
playSound : settings . playSound ,
15
- showNotifications : settings . showNotifications
15
+ showNotifications : settings . showNotifications ,
16
+ openAtStartup : settings . openAtStartup
16
17
} ;
17
18
} ,
18
19
@@ -51,6 +52,14 @@ var SettingsPage = React.createClass({
51
52
onChange = { this . toggleSetting . bind ( this , 'showNotifications' ) } />
52
53
</ div >
53
54
</ 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 >
54
63
< div className = 'row' >
55
64
< button
56
65
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({
11
11
settings = {
12
12
participating : false ,
13
13
playSound : true ,
14
- showNotifications : true
14
+ showNotifications : true ,
15
+ openAtStartup : false
15
16
} ;
16
17
}
17
18
@@ -28,6 +29,9 @@ var SettingsStore = Reflux.createStore({
28
29
if ( ! settings . showNotifications ) {
29
30
settings . showNotifications = true ;
30
31
}
32
+ if ( ! settings . openAtStartup ) {
33
+ settings . openAtStartup = false ;
34
+ }
31
35
32
36
this . _settings = settings ;
33
37
window . localStorage . setItem ( 'settings' , JSON . stringify ( this . _settings ) ) ;
@@ -41,6 +45,15 @@ var SettingsStore = Reflux.createStore({
41
45
this . _settings [ setting ] = value ;
42
46
window . localStorage . setItem ( 'settings' , JSON . stringify ( this . _settings ) ) ;
43
47
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 ) ;
44
57
}
45
58
46
59
} ) ;
You can’t perform that action at this time.
0 commit comments