macos – How can I add a keyboard shortcut for a Terminal Profile?


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 can too 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 cross on Ventura 13.4 22F66.

ORIGINAL ANSWER:

I believe you’re utilizing the “NSUserKeyEquivalents” characteristic 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 identify, like in Terminal.app, unusual issues occur. Shortcuts may fit the primary time however from the second time appkit will invoke one other one with the identical identify (which you’ll inform by watching the menu bar merchandise blink).

AppKit does have a worldwide 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 take a look at 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 *