mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: surface focus follow mouse
This commit is contained in:
@ -197,9 +197,10 @@ class TerminalController: NSWindowController, NSWindowDelegate,
|
||||
window.isOpaque = true
|
||||
window.backgroundColor = .windowBackgroundColor
|
||||
}
|
||||
|
||||
|
||||
window.hasShadow = ghostty.config.macosWindowShadow
|
||||
|
||||
window.focusFollowsMouse = ghostty.config.focusFollowsMouse
|
||||
|
||||
guard window.hasStyledTabs else { return }
|
||||
|
||||
// The titlebar is always updated. We don't need to worry about opacity
|
||||
|
@ -369,6 +369,8 @@ class TerminalWindow: NSWindow {
|
||||
}
|
||||
}
|
||||
|
||||
var focusFollowsMouse: Bool = false
|
||||
|
||||
// Find the NSTextField responsible for displaying the titlebar's title.
|
||||
private var titlebarTextField: NSTextField? {
|
||||
guard let titlebarContainer = contentView?.superview?.subviews
|
||||
|
@ -480,6 +480,10 @@ extension Ghostty {
|
||||
let pos = self.convert(event.locationInWindow, from: nil)
|
||||
ghostty_surface_mouse_pos(surface, pos.x, frame.height - pos.y)
|
||||
|
||||
guard let window = self.window as? TerminalWindow else { return }
|
||||
if !self.focused && window.focusFollowsMouse {
|
||||
Ghostty.moveFocus(to: self)
|
||||
}
|
||||
}
|
||||
|
||||
override func mouseDragged(with event: NSEvent) {
|
||||
|
Reference in New Issue
Block a user