chain-studio/macos/Runner/MainFlutterWindow.swift
flemming-it 696541e5b3
Some checks failed
Security / Security check (push) Failing after 1s
fix(studio): narrow default window to 1280x900
The 1440x900 default felt too wide for first-run: the
Welcome page's 960 px content column left visible slack on
either side even after the centring fix, and the editor's
sidebar plus canvas plus properties panel still didn't
need that much horizontal room on a fresh open.

1280x900 matches the most common laptop effective
resolution, keeps every Studio surface comfortable, and
the operator can resize larger any time. Same value
across all three host platforms (macOS NSWindow setContentSize,
Linux gtk_window_set_default_size, Windows Win32Window::Size).

Version 0.52.3 -> 0.52.4.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-06-01 16:06:50 +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(1280), visible.width)
let targetHeight = min(CGFloat(900), visible.height)
self.setContentSize(NSSize(width: targetWidth, height: targetHeight))
self.center()
}
RegisterGeneratedPlugins(registry: flutterViewController)
super.awakeFromNib()
}
}