QMenuBar QAction MenuRole for "View / Enter Full Screen" menu item
-
I'm not sure since when but macOS began injecting a new menu item into the View menu called "Enter Full Screen". On my keyboard (Traditional Chinese / English dual) it defaults to the "Fn+F" key combo. The Fn key on this keyboard is by default the "change input mode" key for entering Chinese and has a Globe icon. In the Menu bar it appears like "Globe+F".
However, on some apps like Firefox it has it's own hotkey for entering fullscreen (Ctrl+cmd+f) and successfully updates the menu with that, so I know this automatic menu item is configurable.
I suspect this would be similar to how the About or Preferences menus can be manipulated with MenuRoles, but there is no ToggleFullScreen menu role. I couldn't find any discussion online about this, so I'm wondering if this is something that's even on the radar.
-
You must add a menu item to the View yourself, via a short Objective-C++ code, with the action selector toggleFullScreen: and the keyboard shortcut you want — once AppKit detects that such an item already exists, it will not add the automatic item with Fn+F and will honor your shortcut instead.