Skip to content

Commit 85180e1

Browse files
Add option to not kill saver when DPMS kicks in (#154)
1 parent 698139b commit 85180e1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ Options to XSecureLock can be passed by environment variables:
443443
* `XSECURELOCK_SAVER_DELAY_MS`: Milliseconds to wait after starting
444444
children process and before mapping windows to let children be
445445
ready to display and reduce the black flash.
446+
* `XSECURELOCK_SAVER_STOP_ON_DPMS`: specifies if saver is stopped
447+
when DPMS blanks the screen (to save power).
446448
* `XSECURELOCK_XSCREENSAVER_PATH`: Location where XScreenSaver hacks are
447449
installed for use by `saver_xscreensaver`.
448450

main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ const char *blank_dpms_state = "off";
152152
int saver_reset_on_auth_close = 0;
153153
//! Delay we should wait before starting mapping windows to let children run.
154154
int saver_delay_ms = 0;
155+
//! Whetever stopping saver when DPMS is running
156+
int saver_stop_on_dpms = 0;
155157

156158
//! The PID of a currently running notify command, or 0 if none is running.
157159
pid_t notify_command_pid = 0;
@@ -441,6 +443,7 @@ void LoadDefaults() {
441443
saver_reset_on_auth_close =
442444
GetIntSetting("XSECURELOCK_SAVER_RESET_ON_AUTH_CLOSE", 0);
443445
saver_delay_ms = GetIntSetting("XSECURELOCK_SAVER_DELAY_MS", 0);
446+
saver_stop_on_dpms = GetIntSetting("XSECURELOCK_SAVER_STOP_ON_DPMS", 1);
444447
}
445448

446449
/*! \brief Parse the command line arguments, or exit in case of failure.
@@ -1171,7 +1174,7 @@ int main(int argc, char **argv) {
11711174

11721175
// Make sure to shut down the saver when blanked. Saves power.
11731176
enum WatchChildrenState requested_saver_state =
1174-
blanked ? WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state;
1177+
(saver_stop_on_dpms && blanked) ? WATCH_CHILDREN_SAVER_DISABLED : xss_requested_saver_state;
11751178

11761179
// Now check status of our children.
11771180
if (WatchChildren(display, auth_window, saver_window, requested_saver_state,

0 commit comments

Comments
 (0)