Skip to content

No frontlight devices - disable irrelevant plugins#12766

Merged
Frenzie merged 11 commits into
koreader:masterfrom
mergen3107:no_frontlight_disable_plugins
Nov 21, 2024
Merged

No frontlight devices - disable irrelevant plugins#12766
Frenzie merged 11 commits into
koreader:masterfrom
mergen3107:no_frontlight_disable_plugins

Conversation

@mergen3107

@mergen3107 mergen3107 commented Nov 21, 2024

Copy link
Copy Markdown
Contributor

Closes #12764

However, adding these to K4NT did not make them disappear from the list.

Hence, draft PR.

To be continued...


This change is Reviewable

@mergen3107

Copy link
Copy Markdown
Contributor Author

AutoWarmth plugin's _meta.lua only checks for just warm light presence...
Maybe I can add frontlight check there.

@mergen3107 mergen3107 changed the title No frontlight disable plugins No frontlight devices - disable irrelevant plugins Nov 21, 2024
@hius07

hius07 commented Nov 21, 2024

Copy link
Copy Markdown
Member

Please move local Device and the check to the very top of the modules, to avoid unnecessary require executions.

For example

local Device = require("device")
if not Device:isTouchDevice() then
return { disabled = true }
end

@mergen3107

Copy link
Copy Markdown
Contributor Author

Great point! Thank you, I'll try soon

Comment thread plugins/autowarmth.koplugin/main.lua Outdated
Comment on lines +34 to +36
if not Device:hasFrontlight() then
return { disabled = true, }
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can also do auto-nightmode.

Comment on lines +7 to +10
if not Device:hasFrontlight() then
return { disabled = true, }
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one seems unnecessary, there is the not (Device:isKindle() and Device:hasLightSensor()) check just above it and every kindle with light sensor already has a front light... and is being deprecated and removed soon nonetheless.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why I still see it in the list?

Or, am I confusing it thinking that "disabled" should remove it from the list?

@Frenzie Frenzie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, didn't test

@mergen3107

Copy link
Copy Markdown
Contributor Author

@Frenzie
Please wait, I yet need to figure out why on my K4NT these plugins aren't disabled with this PR

@mergen3107

Copy link
Copy Markdown
Contributor Author

Even after all these checks, I still see them in the plugin list on Kindle 4 Non-Touch:
Reader_2024-11-21_112229

@mergen3107

Copy link
Copy Markdown
Contributor Author

OK, think I am confusing it indeed.
Crash.log has only these plugins loaded:

11/21/24-11:21:46 DEBUG FM loaded plugin archiveviewer at plugins/archiveviewer.koplugin 
11/21/24-11:21:46 DEBUG AutoSuspend: init 
11/21/24-11:21:46 DEBUG AutoSuspend: start suspend/shutdown timer at 32553.199598 
11/21/24-11:21:46 DEBUG AutoSuspend: scheduling next suspend check in 1800 
11/21/24-11:21:46 DEBUG AutoSuspend: start t1 timeout timer at 32553.199598 
11/21/24-11:21:46 DEBUG AutoSuspend: scheduling next t1 timeout check in 300 
11/21/24-11:21:46 DEBUG FM loaded plugin autosuspend at plugins/autosuspend.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin batterystat at plugins/batterystat.koplugin 
11/21/24-11:21:46 DEBUG CoverBrowser: setting FileManager display mode to: list_image_meta 
11/21/24-11:21:46 DEBUG CoverBrowser: setting History display mode to: mosaic_image 
11/21/24-11:21:46 DEBUG CoverBrowser: setting Collection display mode to: mosaic_image 
11/21/24-11:21:46 DEBUG FM loaded plugin coverbrowser at plugins/coverbrowser.koplugin 
11/21/24-11:21:46 DEBUG userpatch applied to plugin exporter 
11/21/24-11:21:46 DEBUG FM loaded plugin exporter at plugins/exporter.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin hotkeyshortcuts at plugins/hotkeyshortcuts.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin movetoarchive at plugins/movetoarchive.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin opds at plugins/opds.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin patch_management at plugins/patchmanagement.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin profiles at plugins/profiles.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin qrclipboard at plugins/qrclipboard.koplugin 
11/21/24-11:21:46 DEBUG Terminal: default shell is ash 
11/21/24-11:21:46 DEBUG FM loaded plugin terminal at plugins/terminal.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin texteditor at plugins/texteditor.koplugin 
11/21/24-11:21:46 DEBUG FM loaded plugin timesync at plugins/timesync.koplugin

So, disabled = true is doing its job.

I need to figure out how to skip adding them to the table of plugin list.

@mergen3107

Copy link
Copy Markdown
Contributor Author

Oh, that's weird.

I guess I found a culprit!

It is... (please don't beat me up xD) ... my transferred settings from Kindle Scribe!

The way I figured it out is that I enabled Autofronlight plugin and restarted.

After restart, KOReader kicked Autofrontlight out of the plugin list :D

So the "list" must have been fetched as is from settings.reader.lua, but never checked again upon actual usage.

Can we fix that too?

@mergen3107 mergen3107 marked this pull request as ready for review November 21, 2024 16:37
@mergen3107

Copy link
Copy Markdown
Contributor Author

@Frenzie
This PR is ready for review!

I found out why it didn't "work" for me, see my post above.

So the "list" must have been fetched as is from settings.reader.lua, but never checked again upon actual usage.
Can we fix that too?

This can wait until another PR, if anyone knows a solution.

Thank you!

Comment thread plugins/autowarmth.koplugin/_meta.lua Outdated
@Frenzie

Frenzie commented Nov 21, 2024

Copy link
Copy Markdown
Member

This can wait until another PR

Doesn't really belong in this one regardless. :-)

English is not even my second language :D

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Comment thread plugins/autowarmth.koplugin/_meta.lua Outdated
@mergen3107

Copy link
Copy Markdown
Contributor Author

I synced this branch to prepare for merging.
I hope I didn't break it :D

@Frenzie Frenzie added this to the 2025.01 milestone Nov 21, 2024
@Frenzie Frenzie added the Plugin label Nov 21, 2024
@Frenzie Frenzie merged commit 61ffe2a into koreader:master Nov 21, 2024
@mergen3107 mergen3107 deleted the no_frontlight_disable_plugins branch November 21, 2024 18:49
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Kindle w/o Front light] Unrelated plugins should be disabled

4 participants