Skip to content

Commit

Permalink
Minor fixes for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
superhighfives committed Jun 3, 2024
1 parent 5546a9f commit 116658d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
30 changes: 17 additions & 13 deletions Pika/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
Defaults[.colorFormat] = format
}
}

if action == "format" {
if let format = ColorFormat.withLabel(task!) {
Defaults[.colorFormat] = format
Expand Down Expand Up @@ -281,11 +281,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
}

@IBAction func openAboutWindow(_: Any?) {
aboutWindow = PikaWindow.createSecondaryWindow(
title: "About",
size: NSRect(x: 0, y: 0, width: 550, height: 700),
styleMask: [.titled, .closable, .miniaturizable, .fullSizeContentView]
)
if aboutWindow == nil {
aboutWindow = PikaWindow.createSecondaryWindow(
title: "About",
size: NSRect(x: 0, y: 0, width: 550, height: 700),
styleMask: [.titled, .closable, .miniaturizable, .fullSizeContentView]
)
}
aboutTouchBarController = SplashTouchBarController(window: aboutWindow)

aboutWindow.contentView = NSHostingView(rootView: AboutView().edgesIgnoringSafeArea(.all))
Expand All @@ -305,18 +307,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
.fixedSize(horizontal: false, vertical: true)
.environmentObject(eyedroppers)
.environmentObject(windowManager))
preferencesWindow = PikaWindow.createSecondaryWindow(
title: "Preferences",
size: NSRect(x: 0, y: 0, width: 750, height: view.fittingSize.height),
styleMask: [.titled, .closable, .miniaturizable, .fullSizeContentView],
maxHeight: 500
)

if preferencesWindow == nil {
preferencesWindow = PikaWindow.createSecondaryWindow(
title: "Preferences",
size: NSRect(x: 0, y: 0, width: 750, height: view.fittingSize.height),
styleMask: [.titled, .closable, .miniaturizable, .fullSizeContentView],
maxHeight: 500
)
}

let toolbarHeight: CGFloat = preferencesWindow.frame.height - preferencesWindow.contentLayoutRect.height
windowManager.toolbarPadding = toolbarHeight

preferencesWindow.contentView = view

preferencesWindow.makeKeyAndOrderFront(nil)
preferencesWindow.makeFirstResponder(nil)
notificationCenter.post(name: Notification.Name(PikaConstants.ncTriggerPreferences), object: self)
Expand Down
3 changes: 0 additions & 3 deletions Pika/Views/Visualisation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ struct Visualisation: View {
maxHeight: geo.size.height,
alignment: .center)
.clipped()
.transition(.opacity)
}
}
}
}
.animation(Animation.easeInOut(duration: 1)) // delay is optional, for demo
.onAppear {
self.isShown.toggle()
}
.background(Color(PikaConstants.initialColors.randomElement()!))
}
}

Expand Down

0 comments on commit 116658d

Please sign in to comment.