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.
26 lines
1.2 KiB
Swift
26 lines
1.2 KiB
Swift
import CoreGraphics
|
|
|
|
// ConstraintMath holds the pure math for the window constraint (spec 7.10).
|
|
// The functions have no AppKit dependency. The unit tests cover the functions.
|
|
//
|
|
// Coordinate convention: Cocoa. The origin is bottom-left. The Y axis points
|
|
// up. The window bottom is rect.minY. The window top is rect.maxY. limitY is
|
|
// the strip top edge in Cocoa Y. This convention matches Sources/Util/Geometry.swift.
|
|
enum ConstraintMath {
|
|
|
|
// newHeight returns the new window height so the window bottom sits at
|
|
// limitY. The function keeps the window top fixed. The function returns nil
|
|
// if the window bottom is at limitY or above limitY.
|
|
static func newHeight(windowCocoa: CGRect, limitY: CGFloat) -> CGFloat? {
|
|
guard windowCocoa.minY < limitY else { return nil }
|
|
return windowCocoa.maxY - limitY
|
|
}
|
|
|
|
// isIntentionalMoveDown returns true if the window top is also below
|
|
// (limitY - 100). In this case the user moved the window down on purpose.
|
|
// The service does nothing (spec 7.10, step 3).
|
|
static func isIntentionalMoveDown(windowTopCocoa: CGFloat, limitY: CGFloat) -> Bool {
|
|
return windowTopCocoa < (limitY - 100)
|
|
}
|
|
}
|