Skip to content

Commit

Permalink
Merge pull request #1442 from hovancik/better-break-start
Browse files Browse the repository at this point in the history
Better break window loading
  • Loading branch information
hovancik authored Feb 29, 2024
2 parents 00a8000 + 108efe5 commit 3561c5c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Schedule and Menu options not being updated after change of language
- multiple RTL UI issues
- RPM installer conflicts with other Electron apps
- improve break window loading to fix blank window

## [1.15.1] - 2023-11-19
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion app/break.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ window.onload = (event) => {
})

ipcRenderer.once('progress', (event, started, duration, strictMode, postpone, postponePercent, backgroundColor) => {
ipcRenderer.send('long-break-loaded')
const progress = document.querySelector('#progress')
const progressTime = document.querySelector('#progress-time')
const postponeElement = document.querySelector('#postpone')
Expand Down Expand Up @@ -61,5 +60,6 @@ window.onload = (event) => {
settings.get('language'))
}
}, 100)
ipcRenderer.send('long-break-loaded')
})
}
18 changes: 12 additions & 6 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ function startMicrobreak () {
})
// microbreakWinLocal.webContents.openDevTools()
microbreakWinLocal.once('ready-to-show', () => {
log.info('Stretchly: ready-to-show fired')
})

ipcMain.once('mini-break-loaded', () => {
log.info('Stretchly: Mini Break window loaded')
if (showBreaksAsRegularWindows) {
microbreakWinLocal.show()
} else {
Expand All @@ -807,6 +812,7 @@ function startMicrobreak () {
microbreakWinLocal.center()
}, 0)
}
updateTray()
})

require('@electron/remote/main').enable(microbreakWinLocal.webContents)
Expand Down Expand Up @@ -839,9 +845,6 @@ function startMicrobreak () {
app.dock.hide()
}
}
ipcMain.on('mini-break-loaded', (event) => {
updateTray()
})
}

function startBreak () {
Expand Down Expand Up @@ -926,6 +929,11 @@ function startBreak () {
})
// breakWinLocal.webContents.openDevTools()
breakWinLocal.once('ready-to-show', () => {
log.info('Stretchly: ready-to-show fired')
})

ipcMain.once('long-break-loaded', () => {
log.info('Stretchly: Long Break window loaded')
if (showBreaksAsRegularWindows) {
breakWinLocal.show()
} else {
Expand All @@ -950,6 +958,7 @@ function startBreak () {
breakWinLocal.center()
}, 0)
}
updateTray()
})

require('@electron/remote/main').enable(breakWinLocal.webContents)
Expand Down Expand Up @@ -982,9 +991,6 @@ function startBreak () {
app.dock.hide()
}
}
ipcMain.on('long-break-loaded', (event) => {
updateTray()
})
}

function breakComplete (shouldPlaySound, windows, breakType) {
Expand Down
2 changes: 1 addition & 1 deletion app/microbreak.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ window.onload = (e) => {
})

ipcRenderer.once('progress', (event, started, duration, strictMode, postpone, postponePercent, backgroundColor) => {
ipcRenderer.send('mini-break-loaded')
const progress = document.querySelector('#progress')
const progressTime = document.querySelector('#progress-time')
const postponeElement = document.querySelector('#postpone')
Expand Down Expand Up @@ -58,5 +57,6 @@ window.onload = (e) => {
settings.get('language'))
}
}, 100)
ipcRenderer.send('mini-break-loaded')
})
}

0 comments on commit 3561c5c

Please sign in to comment.