Skip to content

Commit d88a362

Browse files
committed
Startup with OS feature implementation
This commit implements the 'Startup with Windows' feature in 'Settings' #2
1 parent de09217 commit d88a362

File tree

1 file changed

+25
-1
lines changed
  • src/renderer/components/SettingsWindow

1 file changed

+25
-1
lines changed

src/renderer/components/SettingsWindow/index.vue

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<div class="form-item">
1010
<label>
11-
<input type="checkbox" v-model="data.startupWithOS" disabled> <span>Startup with windows</span>
11+
<input type="checkbox" v-model="data.startupWithOS"> <span>Startup with windows</span>
1212
</label>
1313
</div>
1414

@@ -26,6 +26,7 @@ import { remote } from 'electron'
2626
import Window from '@/components/Window'
2727
2828
const windowManager = remote.require('electron-window-manager')
29+
const app = remote.require('electron').app
2930
3031
export default {
3132
name: 'settings-window',
@@ -42,6 +43,13 @@ export default {
4243
save () {
4344
this.$store.dispatch('UPDATE_SETTINGS', this.data)
4445
46+
app.setLoginItemSettings({
47+
...{
48+
openAtLogin: this.data.startupWithOS
49+
},
50+
...this.loginItemSettings
51+
})
52+
4553
windowManager.closeCurrent()
4654
}
4755
},
@@ -50,6 +58,22 @@ export default {
5058
data () {
5159
return this.$store.state.Settings.settings
5260
}
61+
},
62+
63+
data () {
64+
return {
65+
loginItemSettings: {
66+
args: [
67+
'--systray'
68+
]
69+
}
70+
}
71+
},
72+
73+
mounted () {
74+
const settings = app.getLoginItemSettings(this.loginItemSettings)
75+
76+
this.data.startupWithOS = settings.openAtLogin
5377
}
5478
}
5579
</script>

0 commit comments

Comments
 (0)