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://anonsvn.kde.org/home/kde/trunk/kdereview/plasma/runners/dictionary dictionary-krunner cd dictionary-krunner cmake . -DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) make sudo make install kbuildsycoca4 kquitapp krunner krunner |
Love this part:
metaObject()->method(metaObject()->indexOfMethod(“runQuery(QString)”)).invoke(this, Qt::QueuedConnection, Q_ARG(QString, “:” + query));
Awesome work.
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?
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!
> Ability to choose alternative trigger words to “define”?
Yes please. Just “def” will be much more convenient IMHO =)
Looks very good!
Would it be possible to translate everything?
Just one entry, which could be expanded?
Looks great. The italics are a bit too much.
[...] d’un article de Jason A. Donenfeld sur le nouveau plugin “Dictionnaire” qu’il a codé pour [...]
[...] d’un article de Jason A. Donenfeld sur le nouveau plugin “Dictionnaire” qu’il a codé pour [...]
[...] 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 [...]
Just installed the plugin in Kubuntu 10.04. Loving it.
[...] announced in a previous post that I’ve created a dictionary runner for KDE SC 4.6. One requested feature in the comments [...]
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
What’s required to build this? Make just dumps about a billion and three undefined references and terminates with Error 2.
Can you use it with any stardict?