diff --git a/frontend/pluginshare.lua b/frontend/pluginshare.lua new file mode 100644 index 000000000..f0646f552 --- /dev/null +++ b/frontend/pluginshare.lua @@ -0,0 +1,3 @@ +-- PluginShare is a table for plugins to exchange data between each other. Plugins should maintain +-- their own protocols. +return {} diff --git a/plugins/autosuspend.koplugin/main.lua b/plugins/autosuspend.koplugin/main.lua index 50179eb11..a1c44d17b 100644 --- a/plugins/autosuspend.koplugin/main.lua +++ b/plugins/autosuspend.koplugin/main.lua @@ -4,6 +4,7 @@ if not Device:isKobo() and not Device:isSDL() then return { disabled = true, } e local DataStorage = require("datastorage") local LuaSettings = require("luasettings") +local PluginShare = require("pluginshare") local UIManager = require("ui/uimanager") local WidgetContainer = require("ui/widget/container/widgetcontainer") local logger = require("logger") @@ -53,7 +54,14 @@ function AutoSuspend:_schedule(settings_id) return end - local delay = self.last_action_sec + self.auto_suspend_sec - os.time() + local delay + + if PluginShare.pause_auto_suspend then + delay = self.auto_suspend_sec + else + delay = self.last_action_sec + self.auto_suspend_sec - os.time() + end + if delay <= 0 then logger.dbg("AutoSuspend: will suspend the device") UIManager:suspend() diff --git a/plugins/keepalive.koplugin/main.lua b/plugins/keepalive.koplugin/main.lua index b9416afe9..d6ded6e25 100644 --- a/plugins/keepalive.koplugin/main.lua +++ b/plugins/keepalive.koplugin/main.lua @@ -28,8 +28,9 @@ local function showConfirmBox() end if Device:isKobo() then - disable = function() UIManager:_startAutoSuspend() end - enable = function() UIManager:_stopAutoSuspend() end + local PluginShare = require("pluginshare") + enable = function() PluginShare.pause_auto_suspend = true end + disable = function() PluginShare.pause_auto_suspend = false end elseif Device:isKindle() then disable = function() os.execute("lipc-set-prop com.lab126.powerd preventScreenSaver 0")