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:
25
Sources/Constraint/ConstraintMath.swift
Normal file
25
Sources/Constraint/ConstraintMath.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user