Skip to content

Commit

Permalink
Merge pull request #76 from zenangst/improve/window-sizing
Browse files Browse the repository at this point in the history
Use previous size and use windowSize as initial size
  • Loading branch information
zenangst authored Dec 27, 2018
2 parents c6b1e31 + edb5265 commit 4c4e1d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Gray

<div align="center">

[![CI Status](https://travis-ci.com/zenangst/Gray.svg?branch=master)](https://travis-ci.com/zenangst/Gray)
![Swift](https://img.shields.io/badge/%20in-swift%204.2-orange.svg)
[![macOS](https://img.shields.io/badge/macOS-10.14-green.svg)](https://www.apple.com/macos/mojave/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

</div>

<img src="https://github.com/zenangst/Gray/blob/master/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256.png?raw=true" alt="Gray Icon" align="right" />

Current version: 0.9.10 [[Download](https://github.com/zenangst/Gray/releases/download/0.9.10/Gray.zip)]
Expand Down
7 changes: 6 additions & 1 deletion Sources/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}

@objc private func loadApplication() {
let previousFrame = self.window?.frame
self.window?.close()
self.window = nil

Expand All @@ -43,7 +44,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
window.titleVisibility = .hidden
window.toolbar = toolbar
if window.frame.size.width == 0 {
window.setFrame(NSRect.init(origin: .zero, size: .init(width: 200, height: 200)),
window.setFrame(NSRect.init(origin: .zero, size: windowSize),
display: false)
}

Expand All @@ -54,6 +55,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
display: true)
}

if let previousFrame = previousFrame {
window.setFrame(previousFrame, display: true)
}

window.minSize = windowSize
window.resizeIncrements = .init(width: 120 + 10, height: 1)
window.makeKeyAndOrderFront(nil)
Expand Down

0 comments on commit 4c4e1d2

Please sign in to comment.