Skip to content

Instantly share code, notes, and snippets.

-- based on https://gist.github.com/IntrovertedMage/d759ff214f799cfb5e1f8c85daab6cae and https://gist.github.com/sebdelsol/eba2e492473ac1f9e0ecb003d403b7de
-- Menu added in the Reader menu:
-- settings > Status bar > Progress bar > Thickness, height & colors > Read color
-- settings > Status bar > Progress bar > Thickness, height & colors > Unread color
local ReaderFooter = require("apps/reader/modules/readerfooter")
local ProgressWidget = require("ui/widget/progresswidget")
local BD = require("ui/bidi")
local Blitbuffer = require("ffi/blitbuffer")
local Geom = require("ui/geometry")
@IntrovertedMage
IntrovertedMage / 2-change-status-bar-color.lua
Last active August 16, 2025 08:11
KOReader custom status bar color user patch, implements color persitance when changing style fix by @sebdelsol https://gist.github.com/sebdelsol/eba2e492473ac1f9e0ecb003d403b7de
local readerFooter = require("apps/reader/modules/readerfooter")
local ProgressWidget = require("ui/widget/progresswidget")
local BD = require("ui/bidi")
local Blitbuffer = require("ffi/blitbuffer")
local Geom = require("ui/geometry")
local Math = require("optmath")
local Screen = require("device").screen
-- Somewhat empirically chosen threshold to switch between the two designs ;o)
local INITIAL_MARKER_HEIGHT_THRESHOLD = Screen:scaleBySize(12)
@IntrovertedMage
IntrovertedMage / 2-no-filemanager-koreader-title.lua
Last active April 27, 2025 23:52
KOReader user patch that cleanly removes KOReader title bar from the file manager, showcase: https://imgur.com/a/3AokiYm
local FileManager = require("apps/filemanager/filemanager")
local BD = require("ui/bidi")
local Device = require("device")
local filemanagerutil = require("apps/filemanager/filemanagerutil")
local Screen = Device.screen
FileManager.title = ""
function FileManager:updateTitleBarPath(path)
@IntrovertedMage
IntrovertedMage / 2-use-deepl-for-translation.lua
Last active August 19, 2025 23:55
A KOReader user patch to use DeepLs api for translation instead of google translates api. Demonstration: https://imgur.com/a/zTG3EUn
--SETTINGS--========================================
local api_key = "ENTER API KEY HERE"
local USE_FOR_TRANSLATION = true
local USE_FOR_DETECTION = true
local SHOW_DEEPL_LANGUAGES_AS_OPTIONS = true
-------------=========================
@IntrovertedMage
IntrovertedMage / 2-set-translation-language-per-document.lua
Last active March 1, 2025 22:14
A KOReader user patch that allows you to choose what language the translator should translate to for each document separately. Showcase: https://imgur.com/a/7raY7nl
local ReaderHighlight = require("apps/reader/modules/readerhighlight")
local Translator = require("ui/translator")
local _ = require("gettext")
local ffiUtil = require("ffi/util")
local T = ffiUtil.template
ReaderHighlight.onTranslateText = function (self, text, index)
Translator:showTranslation(text, true, nil,self.ui.doc_settings:readSetting("translator_to_language",G_reader_settings:readSetting("translator_to_language")) , true, index)
end
@IntrovertedMage
IntrovertedMage / 2-custom_title.lua
Last active April 22, 2025 20:59
A KOReader user patch to change the text in the title above the filemanager page
local FileManager = require("apps/filemanager/filemanager")
-- Type what you want to replace the 'KOReader' title above your filemanger in the quotes on the next line
local title = "ENTER CUSTOM TITLE HERE (ORIGINALLY 'KOReader')"
-- Example: local title = "Library"
FileManager.title = title
@IntrovertedMage
IntrovertedMage / 2-preferred-dictionaries-menu.lua
Last active March 5, 2025 02:11
A KOReader user patch that adds a menu to make it more easy to set the preferred dictionaries for the book you're currently reading
local Menu = require("ui/widget/menu")
local ReaderDictionary = require("apps/reader/modules/readerdictionary")
local Event = require("ui/event")
local UIManager = require("ui/uimanager")
local util = require("util")
local _ = require("gettext")
local addToMainMenu_orig = ReaderDictionary.addToMainMenu
ReaderDictionary.addToMainMenu = function(self,menu_items)
--=====SETTINGS====================================================================
local maxEntries = 1000
local onlyShowPreferred = true
--=================================================================================
local ReaderDictionary = require("apps/reader/modules/readerdictionary")
local ButtonDialog = require("ui/widget/buttondialog")
local Device = require("device")