ui: frost the empty player window background
This commit is contained in:
@@ -999,17 +999,20 @@ final class PlayerModel: ObservableObject {
|
||||
@MainActor
|
||||
private struct PlayerGlass: NSViewRepresentable {
|
||||
var titlebar = false
|
||||
var blendingMode: NSVisualEffectView.BlendingMode = .withinWindow
|
||||
|
||||
func makeNSView(context: Context) -> NSVisualEffectView {
|
||||
let view = NSVisualEffectView()
|
||||
view.blendingMode = .withinWindow
|
||||
view.blendingMode = blendingMode
|
||||
view.state = .active
|
||||
view.appearance = NSAppearance(named: .vibrantDark)
|
||||
view.material = titlebar ? .titlebar : .hudWindow
|
||||
return view
|
||||
}
|
||||
|
||||
func updateNSView(_ view: NSVisualEffectView, context: Context) {}
|
||||
func updateNSView(_ view: NSVisualEffectView, context: Context) {
|
||||
view.blendingMode = blendingMode
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@@ -1389,10 +1392,17 @@ private struct PlayerContent: View {
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
ZStack(alignment: .top) {
|
||||
Color.black
|
||||
if model.fileName == nil {
|
||||
PlayerGlass(blendingMode: .behindWindow)
|
||||
.allowsHitTesting(false)
|
||||
.accessibilityHidden(true)
|
||||
} else {
|
||||
Color.black
|
||||
}
|
||||
if let view = model.videoView {
|
||||
VideoSurface(view: view)
|
||||
.accessibilityLabel("Video")
|
||||
.opacity(model.fileName == nil ? 0 : 1)
|
||||
.gesture(
|
||||
TapGesture(count: 2).onEnded { model.toggleFullScreen() }
|
||||
.exclusively(before: TapGesture().onEnded { model.hideControls() })
|
||||
@@ -1607,7 +1617,8 @@ private struct WindowChrome: NSViewRepresentable {
|
||||
window.styleMask.insert(.fullSizeContentView)
|
||||
window.titleVisibility = .hidden
|
||||
window.titlebarAppearsTransparent = true
|
||||
window.backgroundColor = .black
|
||||
window.isOpaque = false
|
||||
window.backgroundColor = .clear
|
||||
window.acceptsMouseMovedEvents = true
|
||||
window.collectionBehavior.insert(.fullScreenPrimary)
|
||||
window.appearance = NSAppearance(named: .darkAqua)
|
||||
|
||||
Reference in New Issue
Block a user