chain-studio/macos/Runner/MainFlutterWindow.swift
flemming-it 3097a30428
Some checks failed
Security / Security check (push) Failing after 1s
fix(studio): larger default window — 1440x900 across all platforms
Stefan observed the default Studio window opened smaller
than comfortable when launched fresh (no persisted size).
On macOS specifically the xib-stored default was around
800x600 — too tight to read the sidebar + content + run
panel side-by-side.

Set 1440x900 as the initial content size across all three
host platforms:

 - macOS: MainFlutterWindow.swift sets contentSize via
   NSWindow.setContentSize after the FlutterViewController
   attaches, and centers on the active NSScreen. Clamped to
   the screen's visibleFrame so we never open larger than
   the display (matters for non-Retina external monitors).
 - Linux: gtk_window_set_default_size 1280x720 -> 1440x900
 - Windows: Win32Window::Size 1280x720 -> 1440x900

1440x900 is the effective Retina resolution of a 13" MacBook
(Stefan's dev machine) and the smallest "modern desktop"
footprint that lets the sidebar + content + tool panel
breathe.

Version 0.51.8 -> 0.51.9.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-06-01 00:06:04 +02:00

33 lines
1.2 KiB
Swift

import Cocoa
import FlutterMacOS
class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController()
self.contentViewController = flutterViewController
// Override the window title so the OS task switcher and
// window chrome read "FI Studio" instead of the
// pubspec-derived "fai_studio".
self.title = "F∆I Studio"
// Pick a comfortable default window size. 1440x900 is the
// effective Retina resolution of a 13" MacBook (Stefan's
// dev machine) and the smallest "modern desktop" footprint
// that comfortably fits the sidebar, content area, and a
// tooling panel side-by-side. Clamp to the active screen's
// visibleFrame so we never open larger than the display
// important for external monitors at non-Retina scales.
if let screen = NSScreen.main {
let visible = screen.visibleFrame
let targetWidth = min(CGFloat(1440), visible.width)
let targetHeight = min(CGFloat(900), visible.height)
self.setContentSize(NSSize(width: targetWidth, height: targetHeight))
self.center()
}
RegisterGeneratedPlugins(registry: flutterViewController)
super.awakeFromNib()
}
}