简体   繁体   中英

Is it possible to programmatically add items to global contextual menus?

New to OS X development, wondering if its possible to add my programs menu item to any contextual menu throughout the system when text is selected. It seems it is possible to do in Safari extensions, but wondering if there's a system-wide API for this?

It is possible to add such items. It's not done dynamically at run time. It's a static property of your app.

The functionality is referred to as Services . That documentation is "legacy" but still valid. It's in Objective-C, so you'll have to translate to Swift.

See also System Preferences > Keyboard Shortcuts > Services (in the left-hand column) for where/how users configure Services.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM