Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Rectangle/TitleBarManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,21 @@ class TitleBarManager {
}
lastEventNumber = event.eventNumber
if let toolbarFrame = windowElement.getChildElement(.toolbar)?.frame, toolbarFrame != .null {
titleBarFrame = titleBarFrame.union(toolbarFrame)
// Only include toolbars that are at the top of the window (near the title bar).
// Status bars at the bottom of windows (like in VSCode) are also exposed as toolbars
// but should not be included in the title bar detection area.
let currentWindowFrame = windowElement.frame
if currentWindowFrame != .null {
let windowHeight = currentWindowFrame.height
// In screenFlipped coordinates, maxY is the top edge
// Check if toolbar's top edge is near the window's top edge (within upper 30%)
let distanceFromTop = currentWindowFrame.maxY - toolbarFrame.maxY
// Consider toolbar as "top toolbar" if it's within the upper 30% of the window
// This prevents status bars at the bottom from being incorrectly included
if distanceFromTop >= 0 && distanceFromTop < windowHeight * 0.3 {
titleBarFrame = titleBarFrame.union(toolbarFrame)
}
}
}
guard
titleBarFrame.contains(location),
Expand Down