aboutsummaryrefslogtreecommitdiff
path: root/Hotline
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline')
-rw-r--r--Hotline/Shared/HotlinePanel.swift22
-rw-r--r--Hotline/macOS/HotlinePanelView.swift12
2 files changed, 24 insertions, 10 deletions
diff --git a/Hotline/Shared/HotlinePanel.swift b/Hotline/Shared/HotlinePanel.swift
index 60d1337..ee881a2 100644
--- a/Hotline/Shared/HotlinePanel.swift
+++ b/Hotline/Shared/HotlinePanel.swift
@@ -1,9 +1,11 @@
import Cocoa
import SwiftUI
+fileprivate let HOTLINE_PANEL_SIZE: CGSize = CGSizeMake(476, 114)
+
class HotlinePanel: NSPanel {
init(_ view: HotlinePanelView) {
- super.init(contentRect: .zero, styleMask: [.nonactivatingPanel, .titled, .closable, .utilityWindow, .fullSizeContentView], backing: .buffered, defer: false)
+ super.init(contentRect: NSRect(x: 0, y: 0, width: HOTLINE_PANEL_SIZE.width, height: HOTLINE_PANEL_SIZE.height), styleMask: [.nonactivatingPanel, .titled, .closable, .utilityWindow, .fullSizeContentView], backing: .buffered, defer: false)
// Make sure that the panel is in front of almost all other windows
self.isFloatingPanel = false
@@ -12,7 +14,9 @@ class HotlinePanel: NSPanel {
self.animationBehavior = .utilityWindow
// Allow the panel to appear in a fullscreen space
- self.collectionBehavior.insert(.fullScreenAuxiliary)
+// self.collectionBehavior.insert(.fullScreenAuxiliary)
+ self.collectionBehavior.insert(.canJoinAllSpaces)
+ self.collectionBehavior.insert(.ignoresCycle)
// Don't delete panel state when it's closed.
self.isReleasedWhenClosed = false
@@ -31,9 +35,19 @@ class HotlinePanel: NSPanel {
self.titlebarAppearsTransparent = true
let hostingView = NSHostingView(rootView: view.edgesIgnoringSafeArea(.top))
- hostingView.sizingOptions = [.standardBounds]
+ hostingView.sizingOptions = [.preferredContentSize]
- self.contentView = hostingView
+ let visualEffectView = NSVisualEffectView(frame: NSRect(x: 0, y: 0, width: HOTLINE_PANEL_SIZE.width, height: HOTLINE_PANEL_SIZE.height))
+ visualEffectView.material = .headerView
+ visualEffectView.blendingMode = .behindWindow
+ visualEffectView.state = NSVisualEffectView.State.active
+ visualEffectView.autoresizingMask = [.width, .height]
+ visualEffectView.autoresizesSubviews = true
+ visualEffectView.addSubview(hostingView)
+
+ self.contentView = visualEffectView
+
+ hostingView.frame = visualEffectView.bounds
self.cascadeTopLeft(from: NSMakePoint(16, 16))
}
diff --git a/Hotline/macOS/HotlinePanelView.swift b/Hotline/macOS/HotlinePanelView.swift
index d136869..d486761 100644
--- a/Hotline/macOS/HotlinePanelView.swift
+++ b/Hotline/macOS/HotlinePanelView.swift
@@ -8,7 +8,7 @@ struct HotlinePanelView: View {
@FocusedValue(\.activeServerState) private var activeServerState: ServerState?
var body: some View {
- VStack {
+ VStack(spacing: 0) {
Image(nsImage: ApplicationState.shared.activeServerBanner ?? NSImage(named: "Default Banner")!)
.interpolation(.high)
.resizable()
@@ -97,16 +97,16 @@ struct HotlinePanelView: View {
.frame(width: 18, height: 18)
.help("Settings")
}
- .padding(.top, 8)
+ .padding(.top, 16)
.padding(.bottom, 16)
.padding([.leading, .trailing], 16)
}
// .frame(width: 468)
// .background(colorScheme == .dark ? .black : .white)
- .background(
- VisualEffectView(material: .headerView, blendingMode: .behindWindow)
- .cornerRadius(10.0)
- )
+// .background(
+// VisualEffectView(material: .headerView, blendingMode: .behindWindow)
+// .cornerRadius(10.0)
+// )
}
}