aboutsummaryrefslogtreecommitdiff
path: root/Sources/phbar/Models/Screen.swift
blob: e4b968f594801d79145db3bb5452f735da643fa5 (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
import AppKit

@MainActor
enum Screen {
	/// Frame of the bar within a screen, in global display coordinates.
	static func barFrame(_ screen: NSScreen, position: Config.Position, height: CGFloat) -> NSRect {
		switch position {
		case .top:
			return NSRect(
				x: screen.frame.minX,
				y: screen.frame.maxY - height,
				width: screen.frame.width,
				height: height
			)
		case .bottom:
			return NSRect(
				x: screen.frame.minX,
				y: screen.frame.minY,
				width: screen.frame.width,
				height: height
			)
		}
	}
}