Skip to content

Commit

Permalink
fix: window overflowing small screens
Browse files Browse the repository at this point in the history
...with high zoom level.

Closes #4063
  • Loading branch information
WofWca committed Oct 1, 2024
1 parent c981d4e commit 723a7c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/target-electron/src/application-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export function windowDefaults() {
y,
},
headerHeight,
minWidth: 450,
minHeight: 450,
// On 0.6x zoom Delta Chat and 200x window size it's still somewhat usable,
// not much is overflowing.
minWidth: 225,
minHeight: 125,
main: targetFile,
preload: join(htmlDistDir(), 'preload.js'),
}
Expand Down
7 changes: 6 additions & 1 deletion packages/target-electron/src/windows/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ export function initMinWinDimensionHandling(
): () => void {
const update_min_size = () => {
const { workAreaSize } = screen.getPrimaryDisplay()
if (workAreaSize.width < minWidth || workAreaSize.height < minHeight) {
if (
// A multiplier to make space for the taskbar and the window header.
// Remember that the taskbar could also be placed vertically.
workAreaSize.width * 0.75 < minWidth ||
workAreaSize.height * 0.75 < minHeight
) {
main_window.setMinimumSize(0, 0)
} else {
main_window.setMinimumSize(minWidth, minHeight)
Expand Down

0 comments on commit 723a7c6

Please sign in to comment.