Преглед на файлове

Increase default launcher window size on startup

Set a larger initial storyboard window and enforce a minimum startup content size for better usability.

Made-with: Cursor
huzaifahayat12 преди 4 месеца
родител
ревизия
8bc2c75fb2
променени са 2 файла, в които са добавени 15 реда и са изтрити 2 реда
  1. 13 0
      google_apps/AppDelegate.swift
  2. 2 2
      google_apps/Base.lproj/Main.storyboard

+ 13 - 0
google_apps/AppDelegate.swift

@@ -22,6 +22,19 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         window.titleVisibility = .hidden
         window.styleMask.insert(.fullSizeContentView)
         window.isMovableByWindowBackground = true
+        window.minSize = NSSize(width: 760, height: 520)
+
+        let targetContentSize = NSSize(width: 980, height: 700)
+        if window.contentRect(forFrameRect: window.frame).size.width < targetContentSize.width ||
+            window.contentRect(forFrameRect: window.frame).size.height < targetContentSize.height {
+            let currentCenter = NSPoint(x: window.frame.midX, y: window.frame.midY)
+            var targetFrame = window.frameRect(forContentRect: NSRect(origin: .zero, size: targetContentSize))
+            targetFrame.origin = NSPoint(
+                x: currentCenter.x - (targetFrame.width / 2),
+                y: currentCenter.y - (targetFrame.height / 2)
+            )
+            window.setFrame(targetFrame, display: true)
+        }
     }
 
     func applicationWillTerminate(_ aNotification: Notification) {

+ 2 - 2
google_apps/Base.lproj/Main.storyboard

@@ -686,7 +686,7 @@
                     <window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
                         <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
                         <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
-                        <rect key="contentRect" x="196" y="240" width="480" height="270"/>
+                        <rect key="contentRect" x="196" y="240" width="980" height="700"/>
                         <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
                         <connections>
                             <outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
@@ -705,7 +705,7 @@
             <objects>
                 <viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" id="m2S-Jp-Qdl">
-                        <rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
+                        <rect key="frame" x="0.0" y="0.0" width="980" height="700"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </view>
                 </viewController>