aboutsummaryrefslogtreecommitdiff
path: root/Sources/phbar/Views/BarWindow.swift
blob: 83bbcc25b0101381d056db532cca5b1d5ba35fda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import AppKit

// A non-activating panel: clicking it (e.g. a workspace cell) runs the action
// without stealing focus from the app you're working in.
final class BarWindow: NSPanel {
	init(contentRect: NSRect) {
		super.init(
			contentRect: contentRect,
			styleMask: [.nonactivatingPanel],
			backing: .buffered,
			defer: false
		)

		isFloatingPanel = true
		isOpaque = false
		backgroundColor = .clear
		hasShadow = false
		hidesOnDeactivate = false
		isReleasedWhenClosed = false
		isMovable = false
		becomesKeyOnlyIfNeeded = true
		level = .floating
		collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary, .stationary]
		animationBehavior = .none
	}

	override var canBecomeKey: Bool { true }
	override var canBecomeMain: Bool { false }
}