feat: persist notes window size and use monospaced text
This commit is contained in:
@@ -28,6 +28,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
private var previousApplication: NSRunningApplication?
|
||||
private var alignmentGuides: LauncherAlignmentGuides?
|
||||
private static let positionKey = "launcherPosition"
|
||||
private static let notesSizeKey = "notesWindowSize"
|
||||
private let uninstaller: ApplicationUninstaller
|
||||
private let actionsButton = NSButton(title: "Actions ⌘K", target: nil, action: nil)
|
||||
private let actions = ApplicationActionsController()
|
||||
@@ -240,6 +241,11 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
alignmentGuides?.update(for: window)
|
||||
}
|
||||
|
||||
func windowDidResize(_ notification: Notification) {
|
||||
guard notes != nil, let window, window.styleMask.contains(.resizable) else { return }
|
||||
defaults.set(NSStringFromSize(window.frame.size), forKey: Self.notesSizeKey)
|
||||
}
|
||||
|
||||
func windowShouldClose(_ sender: NSWindow) -> Bool {
|
||||
dismiss()
|
||||
return false
|
||||
@@ -915,6 +921,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
self.launcherViews.first?.setAccessibilityHidden(false)
|
||||
if command == .notes, let previousFrame {
|
||||
self.window?.styleMask = [.borderless]
|
||||
self.window?.minSize = .zero
|
||||
self.window?.appearance = NSAppearance(named: .darkAqua)
|
||||
self.window?.setFrame(previousFrame, display: true)
|
||||
if let material = content as? NSVisualEffectView { roundMaterialCorners(material, radius: 24) }
|
||||
@@ -954,16 +961,22 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
|
||||
)
|
||||
searchField.setAccessibilityLabel(accessibilityLabel)
|
||||
if command == .notes {
|
||||
let savedSize = defaults.string(forKey: Self.notesSizeKey).map(NSSizeFromString)
|
||||
?? NSSize(width: 570, height: 404)
|
||||
window?.appearance = nil
|
||||
window?.styleMask = [.titled, .closable, .fullSizeContentView]
|
||||
window?.styleMask = [.titled, .closable, .resizable, .fullSizeContentView]
|
||||
window?.minSize = NSSize(width: 570, height: 260)
|
||||
window?.standardWindowButton(.miniaturizeButton)?.isHidden = true
|
||||
window?.standardWindowButton(.zoomButton)?.isHidden = true
|
||||
launcherViews.first?.isHidden = true
|
||||
launcherViews.first?.setAccessibilityHidden(true)
|
||||
if var frame = window?.frame {
|
||||
frame.origin.x += (frame.width - 570) / 2
|
||||
frame.origin.y = frame.maxY - 404
|
||||
frame.size = NSSize(width: 570, height: 404)
|
||||
let available = window?.screen?.visibleFrame.size ?? savedSize
|
||||
let size = NSSize(width: min(max(savedSize.width, 570), available.width),
|
||||
height: min(max(savedSize.height, 260), available.height))
|
||||
frame.origin.x += (frame.width - size.width) / 2
|
||||
frame.origin.y = frame.maxY - size.height
|
||||
frame.size = size
|
||||
window?.setFrame(frame, display: true)
|
||||
}
|
||||
if let material = content as? NSVisualEffectView { roundMaterialCorners(material, radius: 14) }
|
||||
|
||||
Reference in New Issue
Block a user