Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hook the OS X dictionary

on osx lion, you can control-command-d or triple-tap on a word that your mouse is pointed to in any app to launch a popover dictionary. i want to make an app to track the words a user is looking up in the dictionary.

how do i observe the event where the user does control-command-d or triple-tap to launch the popover dictionary?

I understand that the specific API for this is HIDictionaryWindowShow.

like image 991
hollow7 Avatar asked Jun 26 '12 19:06

hollow7


People also ask

How do I use Dictionary in OSX?

In the Dictionary app on your Mac, type a word or phrase in the search field in the upper-right corner of the Dictionary window. Note: If you add another Dictionary source, wait for it to download completely before searching for a word or phrase.

How do I get my Mac to speak Dictionary?

Make Dictionary talkGo to System Preferences, click Dictation & Speech, click the Text to Speech tab, and choose a voice. To make Dictionary talk, select a word and Control-click (or right-click) it. From the contextual menu, choose Speech > Start Speaking.

How do I open Oxford Dictionary on Mac?

You can open Dictionary from Launchpad (click the Launchpad icon in the Dock).

How do I fix the Dictionary on my Mac?

Auto-correction is available for languages that your Mac is set up to spell check. To see these languages, go to System Preferences > Keyboard > Text and click the Spelling pop-up menu. Click "Set Up" to learn how to add spelling dictionaries for additional languages.


1 Answers

You can use popoverDidShow:

- (void)awakeFromNib {
    NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter];
    [notificationCenter addObserver:self selector:@selector(popoverDidShow:)
                            name:NSPopoverDidShowNotification object:nil];
}

// dictionary is shown or another NSPopover
- (void)popoverDidShow:(NSNotification*)notify { 
    //your code
} 
like image 64
jackjr300 Avatar answered Sep 23 '22 01:09

jackjr300