mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Merge pull request #421 from sharma2007/bug/terminal_shortcut_fix
Fix terminal keyboard open + sticky outside-click
This commit is contained in:
commit
20df4e62ef
2 changed files with 19 additions and 6 deletions
|
|
@ -82,6 +82,7 @@ struct ContentView: View {
|
|||
@Default(.showStandardMediaControls) var showStandardMediaControls
|
||||
@Default(.externalDisplayStyle) var externalDisplayStyle
|
||||
@Default(.hideNonNotchUntilHover) var hideNonNotchUntilHover
|
||||
@Default(.terminalStickyMode) var terminalStickyMode
|
||||
|
||||
// Dynamic sizing based on view type and graph count with smooth transitions
|
||||
var dynamicNotchSize: CGSize {
|
||||
|
|
@ -520,6 +521,7 @@ struct ContentView: View {
|
|||
currentView: currentViewString
|
||||
)
|
||||
}
|
||||
syncStickyTerminalOutsideClickMonitor()
|
||||
}
|
||||
.sensoryFeedback(.alignment, trigger: haptics)
|
||||
.contextMenu {
|
||||
|
|
@ -546,12 +548,6 @@ struct ContentView: View {
|
|||
)
|
||||
.frame(maxHeight: .infinity, alignment: .top)
|
||||
.environmentObject(privacyManager)
|
||||
.onChange(of: dynamicNotchSize) { oldSize, newSize in
|
||||
guard oldSize != newSize else { return }
|
||||
runAfter(0.1) {
|
||||
vm.shouldRecheckHover.toggle()
|
||||
}
|
||||
}
|
||||
.background(dragDetector)
|
||||
.environmentObject(vm)
|
||||
.environmentObject(webcamManager)
|
||||
|
|
@ -566,6 +562,9 @@ struct ContentView: View {
|
|||
enqueueMusicControlWindowSync(forceRefresh: true)
|
||||
startHiddenEdgeHoverPolling()
|
||||
}
|
||||
.onChange(of: terminalStickyMode) { _, _ in
|
||||
syncStickyTerminalOutsideClickMonitor()
|
||||
}
|
||||
.onChange(of: vm.notchState) { _, state in
|
||||
if state == .open {
|
||||
suppressMusicControlWindowUpdates()
|
||||
|
|
@ -1752,6 +1751,16 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
|
||||
/// Installs the global outside-click monitor when Terminal + sticky mode are active (e.g. keyboard-opened terminal).
|
||||
/// Removes the monitor when the tab, sticky setting, or open state no longer applies.
|
||||
private func syncStickyTerminalOutsideClickMonitor() {
|
||||
guard vm.notchState == .open, terminalStickyMode, coordinator.currentView == .terminal else {
|
||||
removeStickyTerminalClickMonitor()
|
||||
return
|
||||
}
|
||||
installStickyTerminalClickMonitor()
|
||||
}
|
||||
|
||||
private func installStickyTerminalClickMonitor() {
|
||||
guard stickyTerminalClickMonitor == nil else { return }
|
||||
stickyTerminalClickMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown]) { [weak vm] _ in
|
||||
|
|
|
|||
|
|
@ -1041,12 +1041,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
guard Defaults[.enableShortcuts], Defaults[.enableTerminalFeature] else { return }
|
||||
|
||||
if vm.notchState == .closed {
|
||||
closeNotchWorkItem?.cancel()
|
||||
closeNotchWorkItem = nil
|
||||
vm.open()
|
||||
coordinator.currentView = .terminal
|
||||
} else {
|
||||
if coordinator.currentView == .terminal {
|
||||
vm.close()
|
||||
} else {
|
||||
closeNotchWorkItem?.cancel()
|
||||
closeNotchWorkItem = nil
|
||||
coordinator.currentView = .terminal
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue