Created
September 12, 2026 07:39
-
-
Save chandujr/acfa028f14101ec62226a3648fba1e9c to your computer and use it in GitHub Desktop.
A KOReader patch that draws a horizontal separator line below the top header area, matching the length of the bottom status bar separator line.
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
| --[[ | |
| Draws a horizontal separator line below the top header area, | |
| matching the length of the bottom status bar separator line. | |
| INSTALLATION: | |
| Place this in your "koreader/patches/" folder and restart KOReader. | |
| CONFIGURATION: | |
| Set "header_height" below to match the height of your header. | |
| Something like (your current top-margin value + 10) should work good. | |
| e.g., if your top-margin is 20, then set it to 30. | |
| But set whatever you seem ideal to you. | |
| LICENSE: AGPL-3.0 | |
| --]] | |
| local Blitbuffer = require("ffi/blitbuffer") | |
| local Size = require("ui/size") | |
| local Device = require("device") | |
| local Screen = Device.screen | |
| local ReaderView = require("apps/reader/modules/readerview") | |
| -- ===========================!!!!!!!!!!!!!!!=========================== -- | |
| local header_height = 30 | |
| -- Line appearance: | |
| local separator_color = Blitbuffer.COLOR_BLACK -- COLOR_BLACK, COLOR_GRAY, etc. | |
| local separator_thickness = Size.line.medium -- Size.line.thin / .medium / .thick, or a number | |
| -- ===========================!!!!!!!!!!!!!!!=========================== -- | |
| local _ReaderView_paintTo_orig = ReaderView.paintTo | |
| ReaderView.paintTo = function(self, bb, x, y) | |
| _ReaderView_paintTo_orig(self, bb, x, y) | |
| if self.render_mode ~= nil then return end -- EPUBs/reflowable only, not PDF/CBZ | |
| local margin = Size.span.horizontal_default | |
| local line_y = y + header_height | |
| bb:paintRect(x + margin, line_y, Screen:getWidth() - margin * 2, separator_thickness, separator_color) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment