Four months ago I promised to make a dictionary KRunner plugin. I’ve finally started to write it.

It’s currently in kdereview and will hopefully be included with KDE SC 4.6.

It functions as simply as I wanted it to back in March: you hit alt+f2, type “define {your word}”, and presto, the results are there.

Unfortunately, it wasn’t as easy as it ought to have been. I utilize the same data source as the dictionary plasmoid, which is a Plasma::DataEngine, and as it turns out, DataEngine has a few issues with threading, which KRunner relies on. It’s also built around signal/slot async requests, while KRunner uses a blocking thread for computation. I ended up having to invoke a QMetaMethod to shuffle things to the right thread and use a QMutex for synchronization. What a hassle. Nevertheless, the dictionary plugin seems to work pretty well.

Anything I should add to it? Ability to choose alternative trigger words to “define”? Some kind of loading indicator? If you have the time, try out the code and let me know what you think.

Update: Some of you in the comments and on IRC have asked me the best way to try this out immediately. Here are the commands:

svn co svn:// dictionary-krunner
cd dictionary-krunner
cmake . -DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix)
sudo make install
kquitapp krunner
July 29, 2010 · [Print]

14 Comments to “KRunner Dictionary Plugin: Finally”

  1. Andre says:

    Love this part:

    metaObject()->method(metaObject()->indexOfMethod(“runQuery(QString)”)).invoke(this, Qt::QueuedConnection, Q_ARG(QString, “:” + query));

    Awesome work. :)

  2. Thanks! 😀

    What I’d really like to see is to be able to use several dict servers — e.g. what KDict does, only in either a Plasmoid or KRunner.

    Could this be done?

  3. klaatu says:

    Oh man I want this now. But I guess I’ll wait for 4.6 release :)

    But thanks a million, this is gonna be great!

  4. rwman says:

    > Ability to choose alternative trigger words to “define”?

    Yes please. Just “def” will be much more convenient IMHO =)

  5. Name (required) says:

    Looks very good!
    Would it be possible to translate everything?
    Just one entry, which could be expanded?

  6. Andy says:

    Looks great. The italics are a bit too much.

  7. […] d’un article de Jason A. Donenfeld sur le nouveau plugin “Dictionnaire” qu’il a codé pour […]

  8. […] d’un article de Jason A. Donenfeld sur le nouveau plugin “Dictionnaire” qu’il a codé pour […]

  9. […] it has been quite a long time coming but, finally, there is a dictionary plugin for KRunner now. Jason Donenfeld posted in his blog today that he has completed the dictionary plugin for […]

  10. Ricky says:

    Just installed the plugin in Kubuntu 10.04. Loving it. :)

  11. […] announced in a previous post that I’ve created a dictionary runner for KDE SC 4.6. One requested feature in the comments […]

  12. anoneemouse says:

    I think it would be cool if you could have 2 more(with example use):
    spellcheck beaty
    shows suggestions in order of preference
    synonym ugly
    shows synonyms for the word ugly

  13. Nathanael says:

    What’s required to build this? Make just dumps about a billion and three undefined references and terminates with Error 2.

  14. Kevin says:

    Can you use it with any stardict?

Leave a Reply