Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ app.whenReady().then(() => {
createWindow()
const minToTray = localStore.get('minToTray')
const alwaysOnTop = localStore.get('alwaysOnTop')
const openOnStart = localStore.get('openOnStart')

if (minToTray) {
if (minToTray || openOnStart) {
createTray()
}

Expand All @@ -48,6 +49,10 @@ app.whenReady().then(() => {
// remove menu to stop the window being closed on Ctrl+W. See #121
mainWindow.setMenu(null)

if (openOnStart) {
mainWindow.hide()
}

// load shortcuts from storage
loadGlobalShortcuts(localStore.get('globalShortcuts'))

Expand Down Expand Up @@ -119,6 +124,13 @@ ipcMain.on('reload-global-shortcuts', (event, shortcuts) => {
loadGlobalShortcuts(shortcuts)
})

ipcMain.on('open-on-start', (event, status) => {
electron.app.setLoginItemSettings({
openAtLogin: status,
path: electron.app.getPath('exe')
})
})

function getNewWindowPosition() {
const windowBounds = mainWindow.getBounds()
const trayBounds = tray.getBounds()
Expand Down
22 changes: 22 additions & 0 deletions src/renderer/components/drawer/Drawer-settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
:class="minToTrayOnClose ? 'is-active' : 'is-inactive'"
></div>
</div>
<div class="Setting-wrapper">
<p class="Setting-title">Open when system starts</p>
<div
class="Checkbox"
@click="selectOpenOnStart"
:class="openOnStart ? 'is-active' : 'is-inactive'"
></div>
</div>

<p class="Drawer-heading">Global Shortcuts</p>

Expand Down Expand Up @@ -135,6 +143,10 @@ export default {
return this.$store.getters.minToTrayOnClose
},

openOnStart() {
return this.$store.getters.openOnStart
},

notifications() {
return this.$store.getters.notifications
},
Expand Down Expand Up @@ -219,6 +231,16 @@ export default {
this.$store.dispatch('setViewState', payload)
},

selectOpenOnStart() {
const payload = {
key: 'openOnStart',
val: !this.openOnStart
}
ipcRenderer.send('open-on-start', !this.openOnStart)
this.$store.dispatch('setSetting', payload)
this.$store.dispatch('setViewState', payload)
},

selectNotifications() {
const payload = {
key: 'notifications',
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/store/modules/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const state = {
breakAlwaysOnTop: localStore.get('breakAlwaysOnTop'),
minToTray: localStore.get('minToTray'),
minToTrayOnClose: localStore.get('minToTrayOnClose'),
openOnStart: localStore.get('openOnStart'),
notifications: localStore.get('notifications'),
os: process.platform,
theme: localStore.get('theme') || 'Pomotroid'
Expand Down Expand Up @@ -53,6 +54,10 @@ const getters = {
return state.minToTrayOnClose
},

openOnStart() {
return state.openOnStart
},

notifications() {
return state.notifications
},
Expand Down
1 change: 1 addition & 0 deletions src/renderer/utils/LocalStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function generateSettings() {
autoStartBreakTimer: true,
minToTray: false,
minToTrayOnClose: false,
openOnStart: false,
notifications: true,
workRounds: 4,
theme: null,
Expand Down