macos – How can I add a keyboard shortcut for a nested menu merchandise?


Edit:
Ha! I figured it out! AppKit has all the time had this performance! You simply must execute a command like this, which writes a NSUserKeyEquivalent with 0x1B (ASCII ESC, e, 33) as seperator between the titles within the title path:

defaults write com.apple.Terminal NSUserKeyEquivalents -dict-add $'eShelleNew WindoweMan Web page' '@$m'

…or you may as well simply kind Shell->New Window->Man Web page within the “Menu title” subject in system settings, which does this for you.

supply: decompile AppKit and seek for “titlepathbased” strings; landed on -[NSMenuItem _fetchFreshUserKeyEquivalentInfo] which mentions r13 = loc_7ff841d3cc10(rbx, @selector(componentsJoinedByString:), @"x1B");. Additionally referenced this apple neighborhood query. This additionally solutions your query.

Examined move on Ventura 13.4 22F66.

ORIGINAL ANSWER:

I believe you might be utilizing the “NSUserKeyEquivalents” function in AppKit, which apple calls “App Shortcuts”. Apple doesn’t allow you to use a menu path there, and when a number of gadgets share the identical title, like in Terminal.app, unusual issues occur. Shortcuts may match the primary time however from the second time appkit will invoke one other one with the identical title (which you’ll inform by watching the menu bar merchandise blink).

AppKit does have a world variable known as _hasTitlePathBasedUserKeyEquivalent, which can sign that with some hacking we are able to make it do what you need. Till then, you’ll want to try some third-party productiveness instruments which will hack macos or invoke the menu title not directly.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *