Skip to content

Commit

Permalink
Add support for macOS 12 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtheis committed Sep 29, 2023
1 parent b8d41bc commit e152a3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PackageDescription

let package = Package(
name: "FluidMenuBarExtra",
platforms: [.macOS(.v13)],
platforms: [.macOS(.v12)],
products: [
.library(
name: "FluidMenuBarExtra",
Expand Down
10 changes: 8 additions & 2 deletions Sources/FluidMenuBarExtra/FluidMenuBarExtraWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ final class FluidMenuBarExtraWindow<Content: View>: NSPanel {
private lazy var hostingView: NSHostingView<some View> = {
let view = NSHostingView(rootView: rootView)
// Disable NSHostingView's default automatic sizing behavior.
view.sizingOptions = []
if #available(macOS 13.0, *) {
view.sizingOptions = []
}
view.isVerticalContentSizeConstraintActive = false
view.isHorizontalContentSizeConstraintActive = false
view.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -64,7 +66,11 @@ final class FluidMenuBarExtraWindow<Content: View>: NSPanel {
titlebarAppearsTransparent = true

animationBehavior = .none
collectionBehavior = [.auxiliary, .stationary, .moveToActiveSpace, .fullScreenAuxiliary]
if #available(macOS 13.0, *) {
collectionBehavior = [.auxiliary, .stationary, .moveToActiveSpace, .fullScreenAuxiliary]
} else {
collectionBehavior = [.stationary, .moveToActiveSpace, .fullScreenAuxiliary]
}
isReleasedWhenClosed = false
hidesOnDeactivate = false

Expand Down

0 comments on commit e152a3a

Please sign in to comment.