Skip to content

Instantly share code, notes, and snippets.

View sebdelsol's full-sized avatar

sebdelsol

  • Montpellier, France
  • 07:13 (UTC +02:00)
View GitHub Profile
@sebdelsol
sebdelsol / 2-statusbar-better-compact.lua
Last active May 26, 2025 15:26
KOReader userpatch for better compact items status bar
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
-- enhance compact items:
-- use the better frontlight icons, and add the battery percentage
-- better separator for title/chapter/author in compact mode with no separator
local ReaderFooter = require("apps/reader/modules/readerfooter")
local userpatch = require("userpatch")
local footerTextGeneratorMap = userpatch.getUpValue(ReaderFooter.applyFooterMode, "footerTextGeneratorMap")
local symbol_prefix = userpatch.getUpValue(footerTextGeneratorMap.frontlight, "symbol_prefix")
@sebdelsol
sebdelsol / 2-change-status-bar-color.lua
Last active June 27, 2025 10:52
KOReader user patch: change status bar progress color
-- MOVED TO https://github.com/sebdelsol/KOReader.patches
-- based on https://gist.github.com/IntrovertedMage/d759ff214f799cfb5e1f8c85daab6cae
-- 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 Blitbuffer = require("ffi/blitbuffer")
local Math = require("optmath")
local ProgressWidget = require("ui/widget/progresswidget")
@sebdelsol
sebdelsol / 2-statusbar-cycle-presets.lua
Last active May 26, 2025 16:12
KOReader user patch: cycle through all the presets when tapping the status bar
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
-- NEED at least v2025-04-52 !
local ReaderFooter = require("apps/reader/modules/readerfooter")
local util = require("util")
local logger = require("logger")
local FooterCurrentPresetSetting = "footer_current_preset"
@sebdelsol
sebdelsol / 2-filemanager-title-bar.lua
Last active June 24, 2025 12:44
KOReader userpatch to show info in the file browser title with autorefresh_time
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
-- KOReader userpatch to show info in the file manager title bar
-- based on https://gist.github.com/hius07/c53bc1ed00e0490cb1a0709c5ed6e735#file-2-fm-title-info-lua
-- Menu added in the File browser menu (1st icon) to change all the settings and rearrange the items in the title bar
-- Items added: Custom text, Brightness Level, Warmth Level, Up time, Time spent awake, Time in suspend
-- Settings added: Auto refresh clock, Custom separator, Number of spaces around separator, Show wifi when disabled, Show frontlight when off, Show path
-- Fix screen rotation (path was disappearing)
-- Arrange items reorders the items the menu
@sebdelsol
sebdelsol / 2-statusbar-thin-chapter.lua
Last active May 26, 2025 15:28
KOReader user patch: Thin status bar with chapter markers
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
local BD = require("ui/bidi")
local Blitbuffer = require("ffi/blitbuffer")
local Device = require("device")
local Geom = require("ui/geometry")
local Math = require("optmath")
local ProgressWidget = require("ui/widget/progresswidget")
local ReaderFooter = require("apps/reader/modules/readerfooter")
local ReaderToc = require("apps/reader/modules/readertoc")
@sebdelsol
sebdelsol / 2-screensaver-cover.lua
Last active May 26, 2025 15:28
KOReader user patch: Screensaver message do not overlap the cover & clear all widgets when the screensaver has no background
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
-- Add 4 new options @ the end of the "Sleep screen" menu :
-- Close widgets before showing the screensaver
-- Refresh before showing the screensaver
-- Message do not overlap image
-- Center image
-- By default it doesn't change the sleep screen behavior
@sebdelsol
sebdelsol / 2-screensaver-chapter.lua
Last active May 26, 2025 15:29
KOReader user patch: add chapter title and % in the screensaver message
-- **MOVED to https://github.com/sebdelsol/KOReader.patches**
-- Youd need a version >= v2025.04-12 to be able to show the screen saver's info message
local InfoMessage = require("ui/widget/infomessage")
local Math = require("optmath")
local ReaderUI = require("apps/reader/readerui")
local Screensaver = require("ui/screensaver")
local UIManager = require("ui/uimanager")
local _ = require("gettext")
@hius07
hius07 / 2-fm-title-info.lua
Created April 16, 2025 05:33
KOReader userpatch to show info in the file browser title
-- KOReader userpatch to show info in the file browser title
local config = {
-- indicators, comment out unneeded and set the order
"wifi",
"memory", -- RAM used, MiB
"storage", -- free storage, requires SystemStat plugin
"text",
"battery",
"ctime",
@dmalinovsky
dmalinovsky / 2-logical-page-count.lua
Created April 2, 2024 23:02
Patch for KOReader to build logical page count
local ReaderPageMap = require("apps/reader/modules/readerpagemap")
local postInit_orig = ReaderPageMap._postInit
ReaderPageMap._postInit = function(self)
self.ui.document:buildSyntheticPageMapIfNoneDocumentProvided(1818)
-- Run original code
postInit_orig(self)
end
@honix
honix / round_rect.py
Created January 3, 2016 20:59
Tkinter canvas round rect
from tkinter import *
from math import sin, cos
master = Tk()
c = Canvas(master, width=230, height=230)
c.pack()
def create_good_rectangle(c, x1, y1, x2, y2, feather, res=5, color='black'):
points = []