From 506a016c2f393aa648b815dc8e208dc4fffcb237 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 19 Dec 2021 12:46:43 +0100 Subject: [PATCH] Add option to not kill saver when DPMS kicks in --- README.md | 2 ++ main.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d57f06..8722b32 100644 --- a/README.md +++ b/README.md @@ -443,6 +443,8 @@ Options to XSecureLock can be passed by environment variables: * `XSECURELOCK_SAVER_DELAY_MS`: Milliseconds to wait after starting children process and before mapping windows to let children be ready to display and reduce the black flash. +* `XSECURELOCK_SAVER_STOP_ON_DPMS`: specifies if saver is stopped + when DPMS blanks the screen (to save power). * `XSECURELOCK_XSCREENSAVER_PATH`: Location where XScreenSaver hacks are installed for use by `saver_xscreensaver`. diff --git a/main.c b/main.c index 735b61c..0536f62 100644 --- a/main.c +++ b/main.c @@ -152,6 +152,8 @@ const char *blank_dpms_state = "off"; int saver_reset_on_auth_close = 0; //! Delay we should wait before starting mapping windows to let children run. int saver_delay_ms = 0; +//! Whetever stopping saver when DPMS is running +int saver_stop_on_dpms = 0; //! The PID of a currently running notify command, or 0 if none is running. pid_t notify_command_pid = 0; @@ -441,6 +443,7 @@ void LoadDefaults() { saver_reset_on_auth_close = GetIntSetting("XSECURELOCK_SAVER_RESET_ON_AUTH_CLOSE", 0); saver_delay_ms = GetIntSetting("XSECURELOCK_SAVER_DELAY_MS", 0); + saver_stop_on_dpms = GetIntSetting("XSECURELOCK_SAVER_STOP_ON_DPMS", 1); } /*! \brief Parse the command line arguments, or exit in case of failure. @@ -1171,7 +1174,7 @@ int main(int argc, char **argv) { // Make sure to shut down the saver when blanked. Saves power. enum WatchChildrenState requested_saver_state = - blanked ? WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state; + (saver_stop_on_dpms && blanked) ? WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state; // Now check status of our children. if (WatchChildren(display, auth_window, saver_window, requested_saver_state,