From 1888f0aaf321662bd0ad406d874b7dfd8c3876f6 Mon Sep 17 00:00:00 2001 From: Kristian Myram Date: Mon, 12 Oct 2026 01:15:23 +0200 Subject: [PATCH] Fix full-screen shortcut shown on Windows --- crates/engine/src/commands/frontend.rs | 4 +++- crates/ui-egui/src/menus.rs | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/commands/frontend.rs b/crates/engine/src/commands/frontend.rs index 57fdb60a..c94aa8de 100644 --- a/crates/engine/src/commands/frontend.rs +++ b/crates/engine/src/commands/frontend.rs @@ -71,7 +71,9 @@ pub fn specs() -> Vec { fe!("view.snapToGrid", "Snap to Grid", ["View"], Some("Cmd+Shift+'"), "{value?}", always), fe!("view.options", "View Options...", ["View"], Some("Cmd+Alt+U"), "{}", has_comp), fe!("view.layerControls", "Show Layer Controls", ["View"], Some("Cmd+Shift+H"), "{value?}", always), - fe!("view.fullScreen", "Enter Full Screen", ["View"], Some("Ctrl+Cmd+F"), "{}", always), + // macOS uses Control+Command+F for native full screen. On Windows and Linux, + // Cmd maps to Ctrl; the After Effects-style Ctrl+\ is window.maximizeApp. + fe!("view.fullScreen", "Enter Full Screen", ["View"], cfg!(target_os = "macos").then_some("Ctrl+Cmd+F"), "{}", always), fe!( "view.newViewer", "New Viewer", diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 5c61b497..dbe96fdd 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -1537,8 +1537,8 @@ pub type Binding = (egui::Modifiers, egui::Key, String, Value); pub fn bindings(session: &effectcraft_engine::Session) -> Vec { let mut v: Vec = Vec::new(); for (sc, b) in session.shortcuts().bindings() { - // Off macOS `Cmd` is Ctrl, so a Ctrl+Cmd shortcut (Enter Full Screen's Ctrl+Cmd+F) would - // steal the plain Cmd one (Find's Cmd+F): such macOS-only shortcuts aren't bound there. + // Off macOS `Cmd` is Ctrl, so a custom Ctrl+Cmd shortcut would + // steal the plain Cmd one: such macOS-only shortcuts aren't bound there. if !cfg!(target_os = "macos") && sc.split('+').any(|p| p == "Ctrl") && sc.split('+').any(|p| p == "Cmd") { continue; } @@ -1971,6 +1971,18 @@ mod tests { } } + #[test] + fn full_screen_default_is_platform_specific() { + let app = EffectcraftApp::new(effectcraft_engine::Session::default()); + let full_screen = app.session.shortcuts().shortcut_of("view.fullScreen", &Value::Null); + if cfg!(target_os = "macos") { + assert_eq!(full_screen, Some("Ctrl+Cmd+F")); + } else { + assert_eq!(full_screen, None); + assert_eq!(app.session.shortcuts().shortcut_of("window.maximizeApp", &Value::Null), Some("Cmd+\\")); + } + } + #[test] fn ui_and_menu_shortcuts_do_not_collide() { let app = EffectcraftApp::new(effectcraft_engine::Session::default());