From 47ff6124179e3072c1700b916600c348dfdd03c7 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:53:45 +0200 Subject: [PATCH] Profiles: add "on exiting sleep screen" auto-exec trigger (#13430) --- plugins/profiles.koplugin/main.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/profiles.koplugin/main.lua b/plugins/profiles.koplugin/main.lua index b0d34d002..3368008b8 100644 --- a/plugins/profiles.koplugin/main.lua +++ b/plugins/profiles.koplugin/main.lua @@ -212,6 +212,7 @@ function Profiles:getSubMenuItems() }, self:genAutoExecMenuItem(_("on KOReader start"), "Start", k), self:genAutoExecMenuItem(_("on wake-up"), "Resume", k), + self:genAutoExecMenuItem(_("on exiting sleep screen"), "OutOfScreenSaver", k), self:genAutoExecMenuItem(_("on rotation"), "SetRotationMode", k), self:genAutoExecMenuItem(_("on showing folder"), "PathChanged", k, true), -- separator @@ -526,6 +527,13 @@ function Profiles:genAutoExecMenuItem(text, event, profile_name, separator) end return { text = text, + enabled_func = function() + if event == "Resume" then + local screensaver_delay = G_reader_settings:readSetting("screensaver_delay") + return screensaver_delay == nil or screensaver_delay == "disable" + end + return true + end, checked_func = function() return util.tableGetValue(self.autoexec, event, profile_name) end, @@ -927,6 +935,10 @@ function Profiles:onResume() -- global self:executeAutoExecEvent("Resume") end +function Profiles:onOutOfScreenSaver() -- global + self:executeAutoExecEvent("OutOfScreenSaver") +end + function Profiles:onSetRotationMode(mode) -- global local event = "SetRotationMode" if self.autoexec[event] == nil then return end