Skip to content

FR: [add 'current_stablepage' field to sidecar and make sleep screen message read it.] #14933

Description

@zenixlabs

i use synthetic stablepages on both my kindles, and yesterday i set up a sleep screen message (%c - %t), only to notice that the banner shows stablepages only if i turn off the device with the book OPEN. otherwise it just falls back to screen pages. checked the code and found that this happens because when book is closed, BookInfo:expandString() pulls the data from sidecar. so i patched ReaderRolling:onCloseDocument() like so:

function ReaderRolling:onCloseDocument()
	if self.ui.pagemap and self.ui.pagemap:wantsPageLabels() then
		local current_stablepage = self.ui.pagemap:getCurrentPageLabel(true)
		local last_stablepage = self.ui.pagemap:getLastPageLabel(true)
		self.ui.doc_settings:saveSetting("current_stablepage", current_stablepage)
		self.ui.doc_settings:saveSetting("last_stablepage", last_stablepage)
	else 
		self.ui.doc_settings:saveSetting("current_stablepage", nil)
		self.ui.doc_settings:saveSetting("last_stablepage", nil)
	end	
	return orig_readerrolling_onclosedoc(self)
end

and also patched BookInfo:expandString() to read the new fields.

now that in the latest nightlies we are already adding ["pagemap_doc_pages"], ["pagemap_show_page_labels"] and ["pagemap_use_page_labels"] to the sidecar, i feel like a new field for current page label would be super helpful too. and maybe also make the sleep screen message pull from these new fields as well?

thank you. :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions