EPOD Window Bar: a window strip above the macOS Dock
EPOD Window Bar is a macOS agent app. It shows a thin strip above the Dock with one tab per window of the frontmost application. One click raises the window. Build from source with XcodeGen and Xcode. Signing uses Config.xcconfig (ad-hoc by default; a local Local.xcconfig can set a team ID). The app needs Accessibility and Screen Recording permissions, and runs in a reduced mode without Screen Recording. See README.md and docs/ for details.
This commit is contained in:
36
Sources/Util/Geometry.swift
Normal file
36
Sources/Util/Geometry.swift
Normal file
@@ -0,0 +1,36 @@
|
||||
import CoreGraphics
|
||||
|
||||
// Geometry converts between two coordinate systems.
|
||||
//
|
||||
// Cocoa (AppKit) uses a bottom-left origin on the primary screen. The Y axis
|
||||
// points up. NSScreen.frame uses this system.
|
||||
//
|
||||
// Accessibility (AX) and CGWindowList use a top-left origin on the primary
|
||||
// screen. The Y axis points down.
|
||||
//
|
||||
// The primary screen is NSScreen.screens[0]. Its height is the pivot for the
|
||||
// conversion. All functions are pure. The unit tests cover a primary screen
|
||||
// and a second screen above, below, and left of the primary screen.
|
||||
enum Geometry {
|
||||
|
||||
// cocoaToAX converts a rect with a Cocoa origin to a rect with an AX origin.
|
||||
// primaryHeight is the height of the primary screen.
|
||||
static func cocoaToAX(_ rect: CGRect, primaryHeight: CGFloat) -> CGRect {
|
||||
let y = primaryHeight - rect.maxY
|
||||
return CGRect(x: rect.minX, y: y, width: rect.width, height: rect.height)
|
||||
}
|
||||
|
||||
// axToCocoa converts a rect with an AX origin to a rect with a Cocoa origin.
|
||||
// The conversion is symmetric to cocoaToAX.
|
||||
static func axToCocoa(_ rect: CGRect, primaryHeight: CGFloat) -> CGRect {
|
||||
let y = primaryHeight - (rect.origin.y + rect.height)
|
||||
return CGRect(x: rect.minX, y: y, width: rect.width, height: rect.height)
|
||||
}
|
||||
|
||||
// cocoaYToAXTop returns the AX top-left Y for a Cocoa rect top edge.
|
||||
// The Cocoa top edge is rect.maxY. The AX value is the distance from the
|
||||
// primary screen top.
|
||||
static func cocoaYToAXTop(_ cocoaMaxY: CGFloat, primaryHeight: CGFloat) -> CGFloat {
|
||||
return primaryHeight - cocoaMaxY
|
||||
}
|
||||
}
|
||||
15
Sources/Util/Log.swift
Normal file
15
Sources/Util/Log.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
|
||||
// Log holds the os.Logger instances for EPOD Window Bar.
|
||||
// The subsystem is com.epod.windowbar. The spec (section 7.14) defines the
|
||||
// categories. Phase 0 uses the "app" category only. Later phases add more.
|
||||
enum Log {
|
||||
static let subsystem = "com.epod.windowbar"
|
||||
|
||||
static let app = Logger(subsystem: subsystem, category: "app")
|
||||
static let tracking = Logger(subsystem: subsystem, category: "tracking")
|
||||
static let privateAPI = Logger(subsystem: subsystem, category: "private")
|
||||
static let activation = Logger(subsystem: subsystem, category: "activation")
|
||||
static let constraint = Logger(subsystem: subsystem, category: "constraint")
|
||||
static let strip = Logger(subsystem: subsystem, category: "strip")
|
||||
}
|
||||
Reference in New Issue
Block a user