Skip to content

Instantly share code, notes, and snippets.

View consoleaf's full-sized avatar

Gulpy consoleaf

  • Fullmetal Sun of Scorching Pain and Tormenting Misery
  • Moscow
View GitHub Profile

Developing your first plugin for KOReader

So, you've been using KOReader on your phone, jailbroken Kindle, or some other device, and realized you want to have some functionality that's not built into it. You've probably looked around in the #koplugin tags on Github, and there wasn't one that met your needs. Good news: KOReader is easily extendable with Lua, you can make your own plugin somewhat easily, provided you know some Lua or are willing to learn the basics!

In this post, we'll go over what you need to set up to make your plugin, and write a basic "Hello World" plugin. For in-depth reference on KOReader's Lua components and examples of more complicated plugins, please look at the source code over at [[their github repo]]. We will briefly go over some basics of Lua here, but this is not a Lua tutorial. Please refer to the [[Lua documentation]] if you want to know more.

Setting up

Programming without in-editor hints and context-aware autocomplete isn't the best experience, so let's start by setting

Keybase proof

I hereby claim:

  • I am consoleaf on github.
  • I am gulphole (https://keybase.io/gulphole) on keybase.
  • I have a public key ASDicpjY4uxqQMiJTSoqnRNTbwb_8ezgWZba4Or5DBSpJAo

To claim this, I am signing this object:

cmake_minimum_required(VERSION 3.10)
project(AlgoHW5)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_executable(AlgoHW5 main.cpp)
target_link_libraries(AlgoHW5 gdal)
#include <ctime>
#include <future>
#include <iostream>
#include <thread>
using namespace std;
#define EPSILON 1e-5
#define ASYNCMODE
#define DELAY
/* extension.js
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

Keybase proof

I hereby claim:

  • I am consoleaf on github.
  • I am gulphole (https://keybase.io/gulphole) on keybase.
  • I have a public key ASBkYxTrWcCmLpr3mD4GgBHdNR_Eg4X8j0X-wwiBptApnQo

To claim this, I am signing this object:

@consoleaf
consoleaf / main.c
Last active January 28, 2019 15:16
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <ctype.h>
#include <stdbool.h>
char *filepath;
char *prop_name;
char *value;