import AppKit // StripPanel is the always-visible strip above the Dock. The panel does not // take focus from the frontmost application. See spec section 7.7. final class StripPanel: NSPanel { init(contentRect: NSRect) { super.init(contentRect: contentRect, styleMask: [.borderless, .nonactivatingPanel], backing: .buffered, defer: false) becomesKeyOnlyIfNeeded = true hasShadow = false hidesOnDeactivate = false isReleasedWhenClosed = false isFloatingPanel = true isOpaque = false backgroundColor = .clear // The strip joins all Spaces. The strip does not move. The strip does // not take part in the window cycle. collectionBehavior = [.canJoinAllSpaces, .stationary, .ignoresCycle] // The strip is above normal windows but below the Dock. The Dock // magnification can then cover the strip. level = NSWindow.Level(rawValue: Int(CGWindowLevelForKey(.dockWindow)) - 1) // The background uses a visual effect view. The material is close to // the Dock. let effect = NSVisualEffectView(frame: NSRect(origin: .zero, size: contentRect.size)) effect.material = .hudWindow effect.blendingMode = .behindWindow effect.state = .active effect.autoresizingMask = [.width, .height] contentView = effect } // The panel must not become the key window. A click on the strip must not // take focus from the frontmost application. override var canBecomeKey: Bool { false } override var canBecomeMain: Bool { false } }