Cocoa application Enter Full Screen no keyboard shortcut shown - macos

I have a Cocoa application. In the View menu, the system adds an Enter Full Screen menu item. In other applications I see that this menu item has the keyboard shortcut ^⌘F. However in my application this keyboard shortcut is not shown in the menu and unsurprisingly this key combination does not enter full screen.
Interestingly, this keyboard shortcut, although shown in other applications, does not work.
How do I debug and/or fix this?

Any new Xcode application should get the View menu with Enter Full Screen already setup.
You can add the Key command in the Attributes Inspector.
If the key command doesn't work in ANY application, then that's likely a non-programming problem: most likely a conflict with a duplicate key command that's been configured.
Check System Preferences > Keyboard > Shortcuts > App Shortcuts.

Related

macOS Keyboard Shortcuts in Swift

I am creating a macOS app and would like to create a keyboard shortcut for when the user taps the space bar for one of my buttons.
I am not sure where I should start and even where the documentation is for this? What should I be looking for?
You can now add keyboard shortcuts for many of your UI elements directly in a storyboard, by clicking on the Attribute inspector and scrolling down to "Key Equivalent". You just click in the Key Equivalent text field and press the key equivalent on your keyboard.

How to unbind Command-Control-Space key from Mac OS X 10.9?

How can I unbind Command-Control-Space from Mac OS X 10.9?
This shortcut shows Special Characters table and conflicts with my Emacs key binding, and I couldn't disable it from System Preference->Keyboard->Shortcuts.
Thanks.
At least on macOS Sierra to macOS Big Sur ⌃Space is the default binding for Select the previous input source which is on by default (even if only one input source is activated).
You can free it by:
Open System Preferences
Go to Keyboard > Shortcuts > Input Sources
Untick "Select the previous input source"
Afterwards, you should be able to bind it as expected.
You can create custom keyboard shortcuts for most app's menubar choices in System Preferences. If a desired key combination is losing precedence to a default shortcut that you don't use and can't easily disable, simply override it with a new, unobtrusive shortcut.
Open System Prefs / Keyboard / Shortcuts. Select App Shortcuts from the left pane. Toggle the All Applications category's triangle in the main window to point downward (if it's not open already).
If there's an item named Emoji & Symbols* shown there, then click its shortcut combination and enter a new shortcut (such as option-shift-command-t, in this case).
If there's not an item named Emoji & Symbols under All Applications, click the + button at the bottom, type or copy-paste Emoji & Symbols, and then enter a new keyboard shortcut (option-shift-command-t, or anything really). This will free the control-command-space combination for you to use as a specialized shortcut elsewhere.
To remove your custom shortcut, just click to highlight it in the main window of this preference pane, and click the – button at the bottom. The custom shortcut will disappear and the default action will resume.
*Note: On versions older than Mac OS 10.10.3, the menu item is called Special Characters… instead of Emoji & Symbols.
I don't know of any way to disable this, but an alternative option might be to create a shortcut for the app you want to use that in. I created a Command-Control-Space shortcut for Chrome and now Command-Control-Space doesn't bring up the special character palette anymore in Chrome.
failing that you may be better off asking in Apple Stackexchange

Mac OS keyboard shortcut to toggle two menu items

I am working on a dedicated keyboard shortcut controller for a specific app, Avid's Pro Tools. There is a default keyboard shortcut that toggles the view of two windows, "Mix" and "Edit."
Both of these commands have entries on the Window menu in the app. However, there is a little check next to the window that is active, and a little diamond next to the window that isn't. So these switch as the window is toggled (by the single keyboard shortcut).
I'm looking for a way to program a different key using the Mac OS System Application shortcuts. When I assign a new keyboard shortcut to the "Mix" and "Edit" menu items, I don't get the toggle behavior, it just causes the first item in the menu to be active. This makes sense, as it is getting two commands at once. To get the behavior I want now I have to use two keyboard shortcuts, which breaks a UI convention in Pro Tools. Any suggestions appreciated!

System is adding unwanted items to my customized contextual menu in my app

I have customized the contextual menu for my Cocoa application such that only certain items are visible. In spite of my customization, I found that the system adds a menu item -- "Add to iTunes as a spoken track".
I tried removing this item from the menu but somehow, I am unable to get the control. Is there a way this item can be removed, or do I have to write an AppleScript to disable the iTunes option under Keyboard Shortcuts? I hate doing that since I will then have to restore it for the user.
You can control the contents of these menus (system-wide) by using Preferences.
See System Preferences > Keyboard > Keyboard Shortcuts > Services > Text
In my experience, Apple's default items trigger off of the exact title of the menu. For example, I have a toy app with an NSMenu that I am creating entirely in code (no nib). I find that the View menu gets an extra item (for full screen) if I initialize it as follows:
NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:#"View"];
However, if I put an extra space into the name, then Apple doesn't mess with it:
NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:#"View "];
Is there a way this item can be removed, or do I have to write an AppleScript to disable the iTunes option under Keyboard Shortcuts?
Don't fight with The System; those Service items are supposed to appear on every context menu, as specified in the System Preferences. It even appears on the context menu of Safari which I'm using to view this post right now. Yes I agree that having "add to iTunes" enabled by default is a poor choice on the part of Apple, but that's life.
Maybe the user has his/her own service item s/he installed say as an Automator action. In that case the user probably doesn't want to have it removed.

How to tab focus onto a dropdown field in Mac OSX

In Windows, in any windows form or web browser, you can use the tab button to switch focus through all of the form fields.
It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc.
However, in Mac OSX, tab skips dropdown menus. Is there anyway to change this behavior, or access the above items mentioned, without using a mouse?
Go to System Preferences > Keyboard and Mouse, then choose Keyboard Shortcuts. At the bottom, ensure Full Keyboard Access is set to "All controls". It's a long time since I turned it on but I think that's all you need to do
Apple Menu > System Preferences > Keyboard & Mouse > Keyboard Shortcuts:
Change the radio button at the bottom from "Text boxes and lists only" to "All controls."
Edit: Dammit. We're a fast group around here aren't we? :-)
I have found that I also need to set accessibility.tabfocus to 7 in Firefox's about:config.
It's in the System Preferences - this blog post shows where the setting is.

Resources