aboutsummaryrefslogtreecommitdiff
path: root/Sources/phbar/Models/Screen.swift
diff options
context:
space:
mode:
authorTommaso Negri <me@tommasongr.com>2026-07-27 16:18:34 +0200
committerTommaso Negri <me@tommasongr.com>2026-07-27 16:18:34 +0200
commit535b42a7b8304340182ca1367aa42f047eb06bff (patch)
tree88e15512f874a00886fc7b97861feb5e92c6aaf5 /Sources/phbar/Models/Screen.swift
parent6d165c74a5a6b471c155b12ab15ef833d6b2aa36 (diff)
downloadbar-535b42a7b8304340182ca1367aa42f047eb06bff.tar.gz
bar-535b42a7b8304340182ca1367aa42f047eb06bff.zip
scaffold basic structure
Diffstat (limited to 'Sources/phbar/Models/Screen.swift')
-rw-r--r--Sources/phbar/Models/Screen.swift24
1 files changed, 24 insertions, 0 deletions
diff --git a/Sources/phbar/Models/Screen.swift b/Sources/phbar/Models/Screen.swift
new file mode 100644
index 0000000..e4b968f
--- /dev/null
+++ b/Sources/phbar/Models/Screen.swift
@@ -0,0 +1,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
+ )
+ }
+ }
+}