Skip to content

Commit 2d0e347

Browse files
authored
fix: enable Globe+F (fn+F) fullscreen shortcut (#507)
* fix: enable Globe+F (fn+F) fullscreen shortcut for SwiftUI lifecycle app 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. macOS maps Globe+F to ⌃⌘F, so install a local event monitor to bridge the gap. * fix: use KeyCode enum and add CHANGELOG entry
1 parent b87317e commit 2d0e347

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Globe+F (fn+F) fullscreen shortcut not working in SwiftUI lifecycle app
13+
1014
## [0.26.0] - 2026-03-29
1115

1216
### Added

TablePro/AppDelegate.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,25 @@ class AppDelegate: NSObject, NSApplicationDelegate {
125125
self, selector: #selector(handleDatabaseDidConnect),
126126
name: .databaseDidConnect, object: nil
127127
)
128+
129+
installFullscreenKeyMonitor()
130+
}
131+
132+
// MARK: - Fullscreen Shortcut
133+
134+
/// macOS maps Globe+F (fn+F) to ⌃⌘F, but SwiftUI lifecycle apps don't
135+
/// create a real NSMenuItem for "Enter Full Screen" — the shortcut shown
136+
/// in the View menu is a visual hint only, with no key equivalent binding.
137+
private var fullscreenKeyMonitor: Any?
138+
139+
private func installFullscreenKeyMonitor() {
140+
fullscreenKeyMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { event in
141+
let mods = event.modifierFlags.intersection(.deviceIndependentFlagsMask)
142+
guard mods == [.control, .command],
143+
event.keyCode == KeyCode.f.rawValue else { return event }
144+
NSApp.keyWindow?.toggleFullScreen(nil)
145+
return nil
146+
}
128147
}
129148

130149
func applicationDidBecomeActive(_ notification: Notification) {

0 commit comments

Comments
 (0)