From 49ff9c9e6477410852c156331fb85c0747d26ce8 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 | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 39c37fc..67677c6 100644 --- a/README.md +++ b/README.md @@ -408,6 +408,8 @@ Options to XSecureLock can be passed by environment variables: locking) when above xss-lock command line is used. Should be at least as large as the period time set using "xset s". Also used by `wait_nonidle` to know when to assume dimming and waiting has finished and exit. +* `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 a3c5b16..a54fdfa 100644 --- a/main.c +++ b/main.c @@ -144,6 +144,8 @@ int force_grab = 0; int debug_window_info = 0; //! Whether to reset the saver module when auth closes. int saver_reset_on_auth_close = 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; @@ -339,6 +341,7 @@ void LoadDefaults() { debug_window_info = GetIntSetting("XSECURELOCK_DEBUG_WINDOW_INFO", 0); saver_reset_on_auth_close = GetIntSetting("XSECURELOCK_SAVER_RESET_ON_AUTH_CLOSE", 0); + saver_stop_on_dpms = GetIntSetting("XSECURELOCK_SAVER_STOP_ON_DPMS", 1); } /*! \brief Parse the command line arguments, or exit in case of failure. @@ -1036,7 +1039,8 @@ int main(int argc, char **argv) { select(x11_fd + 1, &in_fds, 0, 0, &tv); // Make sure to shut down the saver when blanked. Saves power. - enum WatchChildrenState requested_saver_state = IsBlankedByDPMS(display) ? + enum WatchChildrenState requested_saver_state = + (saver_stop_on_dpms && IsBlankedByDPMS(display)) ? WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state; // Now check status of our children.