diff --git a/CHANGELOG.md b/CHANGELOG.md index 55206f1e..5d5434f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Globe+F (fn+F) fullscreen shortcut not working in SwiftUI lifecycle app + ## [0.26.0] - 2026-03-29 ### Added diff --git a/TablePro/AppDelegate.swift b/TablePro/AppDelegate.swift index 2ee34e2a..dca6b1ca 100644 --- a/TablePro/AppDelegate.swift +++ b/TablePro/AppDelegate.swift @@ -125,6 +125,25 @@ class AppDelegate: NSObject, NSApplicationDelegate { self, selector: #selector(handleDatabaseDidConnect), name: .databaseDidConnect, object: nil ) + + installFullscreenKeyMonitor() + } + + // MARK: - Fullscreen Shortcut + + /// macOS maps Globe+F (fn+F) to ⌃⌘F, but SwiftUI lifecycle apps don't + /// create a real NSMenuItem for "Enter Full Screen" — the shortcut shown + /// in the View menu is a visual hint only, with no key equivalent binding. + private var fullscreenKeyMonitor: Any? + + private func installFullscreenKeyMonitor() { + fullscreenKeyMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { event in + let mods = event.modifierFlags.intersection(.deviceIndependentFlagsMask) + guard mods == [.control, .command], + event.keyCode == KeyCode.f.rawValue else { return event } + NSApp.keyWindow?.toggleFullScreen(nil) + return nil + } } func applicationDidBecomeActive(_ notification: Notification) {