fix: use standard window chrome for notes

This commit is contained in:
2026-10-19 18:16:52 +02:00
parent 2e4a791f29
commit a41b526b58
3 changed files with 16 additions and 14 deletions
+14 -12
View File
@@ -69,7 +69,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
self.pasteboard = pasteboard
self.notesDirectory = notesDirectory
self.toggleSystemTheme = toggleSystemTheme
let window = LauncherPanel(
let window = LauncherWindow(
contentRect: NSRect(x: 0, y: 0, width: 750, height: 474),
styleMask: [.borderless],
backing: .buffered,
@@ -148,7 +148,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
}
guard closeCommand() else { return }
actions.close(animated: false)
(window as? LauncherPanel)?.beginNumberHintSession()
(window as? LauncherWindow)?.beginNumberHintSession()
let frontmost = NSWorkspace.shared.frontmostApplication
if frontmost?.processIdentifier != ProcessInfo.processInfo.processIdentifier {
previousApplication = frontmost
@@ -165,7 +165,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
window?.makeKeyAndOrderFront(nil)
if let notes { notes.focusEditor() }
else { window?.makeFirstResponder(searchField) }
(window as? LauncherPanel)?.sampleNumberHints()
(window as? LauncherWindow)?.sampleNumberHints()
(searchField.currentEditor() as? NSTextView)?.insertionPointColor = SunsetPalette.accent
refreshApplications()
}
@@ -246,7 +246,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
}
func windowDidResignKey(_ notification: Notification) {
(window as? LauncherPanel)?.resetNumberHints()
(window as? LauncherWindow)?.resetNumberHints()
guard !isLaunching, launcherFrameBeforeReview == nil, window?.attachedSheet == nil else { return }
dismiss(restoringFocus: false)
}
@@ -440,7 +440,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
currency.update(query)
isCurrencyCalculation = currency.isCurrency
calculation = currency.result
if calculation != nil { (window as? LauncherPanel)?.resetNumberHints() }
if calculation != nil { (window as? LauncherWindow)?.resetNumberHints() }
if calculation != nil {
results = []
} else if searchField.stringValue.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
@@ -470,7 +470,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
statusLabel.stringValue = "\(results.count - commandCount) applications · \(commandCount) commands"
}
updateOpenButton()
(window as? LauncherPanel)?.sampleNumberHints()
(window as? LauncherWindow)?.sampleNumberHints()
}
func controlTextDidChange(_ notification: Notification) {
@@ -613,7 +613,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
}
private func configureNumberHint(_ cell: ApplicationCell, row: Int, animated: Bool = false) {
let visible = (window as? LauncherPanel)?.numberHintsVisible == true
let visible = (window as? LauncherWindow)?.numberHintsVisible == true
&& calculation == nil && row < 9 && row < resultCount && !isCommandOpen
cell.setNumberHint(visible ? String(row + 1) : nil, animated: animated)
cell.setAccessibilityHelp(visible ? "Command-\(row + 1) opens this entry" : nil)
@@ -638,7 +638,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
@objc private func showActions() {
guard !isLaunching, launcherFrameBeforeReview == nil, window?.attachedSheet == nil, results.indices.contains(tableView.selectedRow) else { return }
guard !isCommandOpen else { return }
(window as? LauncherPanel)?.resetNumberHints()
(window as? LauncherWindow)?.resetNumberHints()
let application = results[tableView.selectedRow]
actions.open = { [weak self] in self?.openApplication(application) }
actions.isFavorite = history.isFavorite(application)
@@ -687,7 +687,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
review.view.bottomAnchor.constraint(equalTo: content.bottomAnchor)
])
for view in launcherViews { view.setAccessibilityHidden(true) }
(window as? LauncherPanel)?.resetNumberHints()
(window as? LauncherWindow)?.resetNumberHints()
openButton.keyEquivalent = ""
updateOpenButton()
var frame = window.frame
@@ -758,7 +758,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
executeCommand(command, dismissOnSuccess: true)
return
}
(window as? LauncherPanel)?.resetNumberHints()
(window as? LauncherWindow)?.resetNumberHints()
isLaunching = true
updateOpenButton()
Task {
@@ -915,6 +915,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
self.launcherViews.first?.setAccessibilityHidden(false)
if command == .notes, let previousFrame {
self.window?.styleMask = [.borderless]
self.window?.appearance = NSAppearance(named: .darkAqua)
self.window?.setFrame(previousFrame, display: true)
if let material = content as? NSVisualEffectView { roundMaterialCorners(material, radius: 24) }
}
@@ -938,7 +939,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
emojiPicker?.closed = close
notes?.closed = close
actions.close(animated: false)
(window as? LauncherPanel)?.resetNumberHints()
(window as? LauncherWindow)?.resetNumberHints()
openButton.keyEquivalent = ""
searchSymbol.isHidden = true
commandBack.setAccessibilityLabel("Back to applications")
@@ -953,6 +954,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
)
searchField.setAccessibilityLabel(accessibilityLabel)
if command == .notes {
window?.appearance = nil
window?.styleMask = [.titled, .closable, .fullSizeContentView]
window?.standardWindowButton(.miniaturizeButton)?.isHidden = true
window?.standardWindowButton(.zoomButton)?.isHidden = true
@@ -1214,7 +1216,7 @@ private final class ApplicationTableView: NSTableView {
}
@MainActor
final class LauncherPanel: NSPanel {
final class LauncherWindow: NSWindow {
override var canBecomeKey: Bool { true }
override var canBecomeMain: Bool { true }
var navigateSelection: ((Int) -> Void)?