Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(desktop): add auto-zoom scaling for high-DPI displays #406

ClosedSuperComboGamer(GitHub profile, opens in a new tab)wants to merge 15 commits intomain fromrefs/pull/406/headopened View on GitHub

Windows does not automatically scale Electron app content for high-DPI displays the way macOS does, causing the app to appear tiny on 4K/1440p monitors. This adds automatic zoom scaling to fix that.

  • Auto-detect display resolution and scale the desktop app UI for 4K/1440p monitors while keeping 1080p unchanged
  • Compute zoom factor from the display's DIP short edge relative to 1080p, snapped to 0.25 increments (max 3.0×)
  • Apply zoom on window creation, display change, move/resize across monitors, unmaximize, and leave-fullscreen
  • Clamp window bounds and minimum size to the display work area after zoom changes
  • Replace built-in viewMenu with custom View menu fixing Ctrl++ (zoom in) , and adding Ctrl+0 to reset to auto-zoom baseline
  • Re-entrancy guards prevent recursive setBounds → move loops; fullscreen/maximized states are skipped
  • On macOS the auto-zoom is a no-op since macOS handles HiDPI scaling natively

Note

Add auto-zoom scaling for high-DPI displays in the desktop app

  • On Windows and Linux, the app now computes a zoom factor based on the display's short edge relative to a reference size, scaling up for high-resolution displays; macOS always uses zoom factor 1.0.
  • Zoom In/Out menu actions adjust a persisted delta stored in a JSON preferences file, so user zoom preference survives restarts.
  • Reset Zoom clears the stored delta and recomputes zoom from display metrics.
  • Windows opened or moved to a different display recompute their zoom, minimum size, and on-screen bounds to fit the new display's work area.
  • Behavioral Change: window minimum size and bounds are now clamped to the display work area when not maximized or fullscreen; display metric changes (e.g. resolution/DPI changes) clear any user zoom delta on Windows/Linux.
Macroscope summarized 03bc111.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 3f222629-7b30-4cb2-a280-b77dd0570619

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands and usage tips.

      Tip

      CodeRabbit can suggest fixes for GitHub Check annotations.

      Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

    2. Couple Qs:

      1. If I set a zoom myself, will this override it?
      2. Is this windows-only? Can it be?
      3. How does it handle multiple monitors? Esp. if I have some that are HighDPI and others that are not
    3. SuperComboGamer(GitHub profile, opens in a new tab)commented

      @t3dotgg

      If I set a zoom myself, will this override it? No. Your manual zoom (Ctrl+= / Ctrl+-) is persisted and respected, I added zoom persistence in this PR since Electron doesn't have it built-in. Auto-zoom won't override it. Ctrl+0 resets back to auto.

      Is this windows-only? Can it be? Auto-zoom is Windows + Linux only. macOS is skipped since Retina handles DPI natively. Zoom persistence works on all platforms.

      How does it handle multiple monitors? Zoom is stored as a delta from each display's auto-computed, baseline not an absolute value. So if you bump zoom by +0.25 on a 4K monitor (auto 2.0 → 2.25), dragging to a 1080p monitor gives you 1.0 + 0.25 = 1.25, not 2.25. Your intent (“slightly bigger than default”) transfers correctly across displays.

      Note: I don't have a Mac or Linux machine so I couldn't test on those platforms, but it should work, macOS just skips auto-zoom entirely and the zoom persistence uses standard Electron/Node APIs.

    4. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    5. A small thing i have to say, can someone add a button to manually change the scaling? i have issues with my eyes and i can't see anything without 200% zoom..

    6. Closing because the desktop architecture was replaced and automatic zoom by display resolution is an opinionated behavior that should be reconsidered against the current app.

      This was closed as part of a large repo-wide maintenance sweep. If you think it's still relevant, please reopen.

    7. juliusmarminge closed this

Sign in to join this conversation.