mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Profiles: add "on exiting sleep screen" auto-exec trigger (#13430)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user