Writing my First KRunner Plugin ft. MySQL Connection

Finally managed to make a KRunner plugin linking my Web Tech 2 project’s database. It allows the user to search the database from anywhere.

Quick Recipe KRunnerIt is really easy to do it. I followed this guide from KDE website: http://techbase.kde.org/Development/Tutorials/Plasma/PythonRunner

To make it access the database, you need to import the Python/MySQL connector

import mysql.connector

We write the codes to query the database and send the results to KRunner. q contains the text the user input.

Writing KRunner plugin with MySQL query
When its done, we compile it and install it:

plasmapkg –type runner –install ./

It’s done 🙂

Here’s the source code: qr_runner

2 thoughts on “Writing my First KRunner Plugin ft. MySQL Connection

  1. Initially i was trying to use c++ but i found the syntax a but difficult as a beginner. Then i set to python which is the easiest of all 😉

Leave a Reply

Your email address will not be published. Required fields are marked *