Open panels above the notch; chat paperclip and in-chat file drop
- NSOpenPanel opened from BroV appeared under the notch (BroV floats above the menu bar): presentAboveNotch shows it one level higher, non-modally. Used by the terminal paperclip, the chat paperclip and the chat folder picker in Settings. - Chat: paperclip next to the input attaches a file; dropping a file over the open chat attaches it directly instead of the shelf animation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,22 @@ final class ChatTabs {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Open panel above the notch
|
||||
|
||||
extension NSOpenPanel {
|
||||
/// BroV floats above the menu bar, so a regular open panel would appear underneath
|
||||
/// it. Shown non-modally one level above the notch (runModal resets the level).
|
||||
func presentAboveNotch(_ done: @escaping @MainActor ([URL]) -> Void) {
|
||||
level = NSWindow.Level(rawValue: Int(CGWindowLevelForKey(.mainMenuWindow)) + 5)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
begin { response in
|
||||
let urls = response == .OK ? self.urls : []
|
||||
MainActor.assumeIsolated { if !urls.isEmpty { done(urls) } }
|
||||
}
|
||||
orderFrontRegardless()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Terminals
|
||||
|
||||
@MainActor
|
||||
@@ -155,8 +171,7 @@ final class TerminalStore: NSObject, LocalProcessTerminalViewDelegate {
|
||||
panel.allowsMultipleSelection = true
|
||||
panel.prompt = "Вставить"
|
||||
panel.message = "Пути выбранных файлов появятся в терминале"
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
if panel.runModal() == .OK { insertPaths(panel.urls, into: id) }
|
||||
panel.presentAboveNotch { [weak self] urls in self?.insertPaths(urls, into: id) }
|
||||
}
|
||||
|
||||
static func shellEscaped(_ path: String) -> String {
|
||||
|
||||
Reference in New Issue
Block a user