Skip to content

Commit

Permalink
Merge pull request #1184 from hovancik/fix/pref-height
Browse files Browse the repository at this point in the history
Don't allow Preferences to be bigger then avail height
  • Loading branch information
hovancik authored Aug 6, 2022
2 parents e5777e0 + 9055d72 commit 90da71c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- counting break time when break starts
- breaks not being finished when exclusion starts
- incorrect format in logs
- Preferences bigger then available height

## [1.10.0] - 2022-2-22
### Added
Expand Down
19 changes: 16 additions & 3 deletions app/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,26 @@ window.onload = (e) => {

function setWindowHeight () {
const classes = document.querySelector('body').classList
const height = document.querySelector('body').scrollHeight
const scrollHeight = document.querySelector('body').scrollHeight
const availHeight = window.screen.availHeight
let height = null
if (classes.contains('darwin')) {
remote.getCurrentWindow().setSize(bounds.width, height + 32)
if (scrollHeight + 32 > availHeight) {
height = availHeight
} else {
height = scrollHeight + 32
}
} else if (classes.contains('win32')) {
remote.getCurrentWindow().setSize(bounds.width, height + 40)
if (scrollHeight + 40 > availHeight) {
height = availHeight
} else {
height = scrollHeight + 40
}
}
// linux is broken ;/
if (!!height) {
remote.getCurrentWindow().setSize(bounds.width, height)
}
}

function realBreakInterval () {
Expand Down

0 comments on commit 90da71c

Please sign in to comment.