Skip to content

Commit

Permalink
Startup with OS feature implementation
Browse files Browse the repository at this point in the history
This commit implements the 'Startup with Windows' feature in 'Settings' #2
  • Loading branch information
evsar3 committed Mar 28, 2020
1 parent de09217 commit d88a362
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/renderer/components/SettingsWindow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="form-item">
<label>
<input type="checkbox" v-model="data.startupWithOS" disabled> <span>Startup with windows</span>
<input type="checkbox" v-model="data.startupWithOS"> <span>Startup with windows</span>
</label>
</div>

Expand All @@ -26,6 +26,7 @@ import { remote } from 'electron'
import Window from '@/components/Window'
const windowManager = remote.require('electron-window-manager')
const app = remote.require('electron').app
export default {
name: 'settings-window',
Expand All @@ -42,6 +43,13 @@ export default {
save () {
this.$store.dispatch('UPDATE_SETTINGS', this.data)
app.setLoginItemSettings({
...{
openAtLogin: this.data.startupWithOS
},
...this.loginItemSettings
})
windowManager.closeCurrent()
}
},
Expand All @@ -50,6 +58,22 @@ export default {
data () {
return this.$store.state.Settings.settings
}
},
data () {
return {
loginItemSettings: {
args: [
'--systray'
]
}
}
},
mounted () {
const settings = app.getLoginItemSettings(this.loginItemSettings)
this.data.startupWithOS = settings.openAtLogin
}
}
</script>
Expand Down

0 comments on commit d88a362

Please sign in to comment.