Created
June 11, 2025 20:25
-
-
Save ebanDev/ad067c912db947dc15a2e0c4a0a99240 to your computer and use it in GitHub Desktop.
Hide Latest Visited Folder Indicator Patch for KOReader Mosaic View
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Hide Latest Visited Folder Indicator Patch for KOReader | |
======================================================== | |
This patch removes the horizontal bar (underline) under the "latest visited" | |
folder in the mosaic view of KOReader's file browser. | |
**Features:** | |
- Disables the focus indicator (underline) for all folders in mosaic view | |
- Maintains compatibility with existing MosaicMenuItem functionality | |
- Clean, lightweight implementation with minimal overhead | |
**Installation:** | |
Place this file in `koreader/patches/` and restart KOReader. | |
**Author:** Eban | |
**License:** Same as KOReader (AGPL v3) | |
]] | |
-- Prevent double-loading | |
if rawget(_G, "HideLatestVisitedPatchApplied") then return end | |
_G.HideLatestVisitedPatchApplied = true | |
------------------------------------------------------------ | |
-- MOSAIC MENU PATCHING | |
------------------------------------------------------------ | |
local original_require = require | |
function require(module_name) | |
local result = original_require(module_name) | |
if module_name == "mosaicmenu" and type(result) == "table" then | |
local success, Blitbuffer = pcall(require, "ffi/blitbuffer") | |
if not success then return result end | |
if result._updateItemsBuildUI then | |
local original_updateItemsBuildUI = result._updateItemsBuildUI | |
result._updateItemsBuildUI = function(self) | |
local select_number = original_updateItemsBuildUI(self) | |
local function patch_items(group) | |
if type(group) ~= "table" then return end | |
for _, item in ipairs(group) do | |
if type(item) == "table" then | |
if item.onFocus and item.onUnfocus and item._underline_container then | |
item.onFocus = function(self) | |
if self._underline_container then | |
self._underline_container.color = Blitbuffer.COLOR_WHITE | |
end | |
return true | |
end | |
item.onUnfocus = function(self) | |
if self._underline_container then | |
self._underline_container.color = Blitbuffer.COLOR_WHITE | |
end | |
return true | |
end | |
end | |
patch_items(item) | |
end | |
end | |
end | |
if self.item_group then | |
patch_items(self.item_group) | |
end | |
return select_number | |
end | |
end | |
end | |
return result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've rewritten your patch to use KOReader's userpatch tools. Please check here.
It's way much simpler, about ⅕ of the original code, and it works well alongside other patches that need access to the CoverBrowser plugin, instead of causing them to crash.