Skip to content

fix: scaling issue#185

Open
ZFordDev wants to merge 1 commit into
mainfrom
178-highdpi-4k-automatic-scaling-detection
Open

fix: scaling issue#185
ZFordDev wants to merge 1 commit into
mainfrom
178-highdpi-4k-automatic-scaling-detection

Conversation

@ZFordDev

Copy link
Copy Markdown
Owner

Pull Request

Thank you for contributing to SnapDock!
Please complete the sections below to help us review your PR.


Summary

This PR introduces automatic high‑DPI scaling for SnapDock using Electron’s built‑in compositor zoom.
Several users reported that SnapDock appears too small on 4K and high‑DPI displays.
This change improves readability and UI accessibility without modifying renderer logic or CSS.

The scaling logic is applied in the main process and adjusts the BrowserWindow zoomFactor based on the display’s scaleFactor.
This ensures consistent behavior across Windows, Linux, and multi‑monitor setups.

This PR is pending validation on true 4K hardware, but initial testing on mixed‑DPI setups shows correct behavior.


Type of Change

  • Bug fix
  • New feature
  • UI/UX improvement
  • Documentation update
  • Refactor / cleanup

Details

SnapDock previously relied on default Electron scaling, which does not automatically adjust for high‑DPI displays.
On 4K monitors or systems using 125–175% OS scaling, the UI rendered too small.

This PR adds:

  • DPI detection via screen.getPrimaryDisplay().scaleFactor
  • A simple mapping from scaleFactor → zoomFactor
  • Application of zoomFactor inside createWindow() after BrowserWindow creation

This approach scales the entire compositor (editor, preview, UI, sidebar, tab bar) without requiring CSS changes or renderer‑side logic.

The implementation is minimal, safe, and isolated to the main process.


Testing

  • Builds successfully
  • Tested on Windows
  • Tested on Linux
  • No regressions found

Testing notes:

  • Verified correct scaling behavior on mixed‑DPI setups (laptop + external monitor)
  • Confirmed zoomFactor applies correctly when placed inside createWindow()
  • Verified compositor scaling via window.devicePixelRatio and layout width changes
  • Pending validation on native 4K hardware for final confirmation

Related Issues

Fixes #178


Additional Notes (optional)

This is a minimal hotfix intended to address immediate usability concerns reported by the community.
A follow‑up PR may introduce user‑controlled font scaling (#176) and Tools Menu integration (#177).

@ZFordDev ZFordDev linked an issue Jun 29, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

High‑DPI / 4K Automatic Scaling Detection

1 participant